is there a way to change/refresh token when data in db changes such as role?
Hi, I had a project using NextAuth as my provider and the JWT strategy. When I use the database strategy, whenever I change the user’s role, they are automatically redirected to their own page. However, when I use the JWT strategy, I have to log out and log in again to get the newest token. Is there any way I can change the behavior so the token automatically refreshes when I change the role?
5 Replies
I need the automatic behavior when the session changes
Unfortunately that's not possible with JWTs. They are stateless, which means once created there is no way to revoke or modify their content.
so i should just use the database strat?
Yup
sed to leave the edge middleware:((