How do I update the JWT token in the clients browser #11791
Unanswered
benkeeling98
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using Auth.js V5 with the credentials provider. I am authenticating the user with my custom backend, before returning the User data and a Refresh Token and Access Token. I then save the User information (Name, email, ect) along with the token in the JWT callback, before passing it to the Session.
I can not, however, update the JWT token when I try and refresh the access token after it expires after one minute. When I refresh the token, it successfuly retrieves a new access token and passes it to the session, but the new token is never updated in the JWT cookie.
I believe this is due to this action happening in a server component, and thus not having access to modify or update the JWT in the clients browser.
How would I go around updating the JWT, so that I can save the new access token when it is refreshed?
My auth.ts file is below
Beta Was this translation helpful? Give feedback.
All reactions