Has anyone been able to get auth roles working with Prisma and v4 #4117
-
I have been stuck on this for the last couple days, all the research I have done is just info about v3 which is not very useful at the moment. I am interested if anyone has been able to get this working and could provide a repo or some info about it? All of the code below is a mix of what I have put together so far, (not working) I thought atleast If I leave it here it may help. [...nextauth].js
schema.prisma
/models/User.js
/models/index.js
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
If I understand correctly, you want to save the user's role into the session? If so, then yes I have but with a little different approach. I didn't even know you could use it like this, although I am using prisma 😅 Here is the simplified code: Provider
You don't need to modify signIn callback, but jwt and session yes. JWT
Session
This is how to add different params to Credentials signIn, as mentioned above
Hope it helps ✌ |
Beta Was this translation helpful? Give feedback.
If I understand correctly, you want to save the user's role into the session? If so, then yes I have but with a little different approach. I didn't even know you could use it like this, although I am using prisma 😅
Here is the simplified code:
Provider