Skip to content

Http only cookie security vs /api/auth/session #1860

Discussion options

You must be logged in to vote

Hi there! You can be ensured, that correct measurements are taken. Here is the code that runs when you try to contact the /api/auth/session endpoint.
https://github.com/nextauthjs/next-auth/blob/main/src/server/routes/session.js

When you use JWT+cookie for storing your information, it is signed and must be verified on decoding, to make sure the content is not tampered with. Optionally you can also encrypt the cookie, which may result in some size increase though, so it is not applied by default. In general, in applications where you are using NextAuth.js, a short-lived token is the best type of defense. Even with all the steps, we have taken, if someones get hold of the cookie, - with eno…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@pawelphilipczyk
Comment options

@igordanchenko
Comment options

@balazsorban44
Comment options

Answer selected by balazsorban44
Comment options

You must be logged in to vote
1 reply
@El-Nazy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants