I have a Next.js project with next-auth hooked up. But I'm confused on how next-auth store sessions.
On my Chrome cookie, I found this session-token: eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..3_1xKir8Uf2dwky2._druNa1meJemDgeeYw5o6S840s_sW4DShuEu1w34RVAe8cyHm8-ryK5smM1ecKo1KZ_2faPUNpQTwMEUr-AW0Lo_0Oei_n9VIu7xTSET6W0ANdrL2Xg9ZUG9EziZYaW0VFEu.nPkQMkGcrvFRN5BIVvG_ng
, but its payload is empty.
So my question is:
- How is sessionId stored on the client side?
- Does it store only the sessionId or full session data?
- If it only stores the sessionId on client side, then does server-side manages session sharing on multi instances like serverless by default? I'm going to deploy it on Vercel.
next-auth
stores the JWT session token in a server-readable-only cookie. See the "What are the advantages of JSON Web Tokens?" section in next-auth.js.org/faq. – Petterson