Access encoded JWT from Session instance #2974
-
When implementing callbacks I'm wondering if access to the encoded Something like: async session({ session, user, token, encodedToken }): Promise<Session> {
// -- snip --
} My goal is to attach extra data to my |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
we don't expose the raw token to the frontend, but you can read it on the backend using https://next-auth.js.org/configuration/options#jwt-helper Also, you cannot modify the session directly from the client, since the session is saved in an HttpOnly cookie. There is a discussion on #2269 to make updating the session easier |
Beta Was this translation helpful? Give feedback.
we don't expose the raw token to the frontend, but you can read it on the backend using
getToken({ raw: true })
https://next-auth.js.org/configuration/options#jwt-helper
Also, you cannot modify the session directly from the client, since the session is saved in an HttpOnly cookie.
There is a discussion on #2269 to make updating the session easier