Replies: 4 comments 1 reply
-
I am facing the same problem. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Same issue myself, seem's like just manually retrieving the role column in session callback is the way to go for now unfortunately. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Same issue. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi! I fixed by adding also the JWT method to the callbacks: callbacks: {
async jwt(params) {
if(params.user) {
params.token.role = params.user.role
}
return params.token
},
session({session,token}) {
session.user.role = token.role
return session
}
}
```
Also make sure that the user object you are returning from the authorize function of the credentialsProvider has the role value |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
My issue is within the session callback, I can't seem to retrieve a role and put it in a session. "token.role" and "user.role" are both undefined.
1. api/auth[...nextauth]/route.ts
2. types/auth.ts
3. prisma.schema
Beta Was this translation helpful? Give feedback.
All reactions