-
Authentication Setup:
When a session gets created I plan to fetch the users roles from my DB and store it in the session. I will also be creating an The scenario is say a user has the Approach: Questions: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I'm assuming you are using JWTs since you say you want to store your users roles inside the session? If not, I'm confused since NextAuth has support for normal db session, and it creates a session for a user in the This way, when you remove a user's role, the |
Beta Was this translation helpful? Give feedback.
I'm assuming you are using JWTs since you say you want to store your users roles inside the session? If not, I'm confused since NextAuth has support for normal db session, and it creates a session for a user in the
session
table. So you could easily just fetch the user-roles in thesession()
function or modify the adapter to include it whengetUser()
is called.This way, when you remove a user's role, the
keepAlive
trigger will reflect this as soon as it is triggered.