Next.js Discord

Discord Forum

NextAuth: How do you regenerate a JWT with updated details, without re-signing in?

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Using credentials + JWT strategy. While update() exported by useSession() updates the session, the JWT remains outdated, meaning that if you refresh the browser all changes are lost as the session is repopulated from this JWT.

It is also possible to run signIn() exported by 'next-auth/react' to force a visit to the signin page and regenerate the JWT but this is not really a solution for obvious reasons.

Even if it's some roundabout hacky way, I would love to be able to update some details in a DB (I'm using Prisma), and also update the JWT with the new details.

0 Replies