Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual cookie serialization #20

Open
eliasmalik opened this issue Dec 15, 2017 · 0 comments
Open

Manual cookie serialization #20

eliasmalik opened this issue Dec 15, 2017 · 0 comments

Comments

@eliasmalik
Copy link

In both these places you're manually constructing the cookie string:

res.status(201).set({ Location: '/library', 'Set-Cookie': `token=${token}; HttpOnly; Max-Age=9000` });

res.status(201).set({ Location: '/library', 'Set-Cookie': `token=${token}; HttpOnly; Max-Age=9000` });

But you've already included the cookie package in your project which handles serialization for you. You're already using it to parse cookies:

const userJwt = parse(req.headers.cookie);

You should also use it to serialize to reduce the possibility of manual error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant