Integrate Nextjs with NextAuth and Zitadel as well as life Roles update
I have been trying integrate Zitadel with NextAuth/Nextjs but I always struggle to get live Role changes or a way to force-refresh if a role changes directly from Zitadel.
I did a work around of getting the roles every 10 seconds, but there is a case that does not work:
Since Zitadel sends the role with the access token/id if a role gets created after a user had logged in and had the role given to them, it will not be sent/updated into the user's roles........... In my case a new role can be required very often.
If anyone can help or set an example of auth config with Nextauth would be awesome.
10 Replies
any hopes?
Hm can you elaborate what you are trying to do? I am not sure I understand 😉
Basically, through nextauth i am retriving the profile normally with no issues, but lets say a new role was created and given to a user, the new role does not get sent to from zitadel, this only happens when a role is created after A USER had signed in and is in the session
Hm, does that happen if you call the userinfo endpoint?
Yes, the same case if I call the userinfo endpoint
Any ideas?
I've managed to fix this issue
As a suggestion it would be nice to have a guide/example how to set it up with the recent nextjs and next Auth v4 and v5
Keep up the good work!
Oh, how? Mind sharing for the community? I give you a 🥨 in return 😂
Fair that is something we could improve 😅
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View
Oh well that is not nice, yeah
@peintnermax have you seen that?
which nextauth, nextjs version are you using?
Unknown User•12mo ago
Message Not Public
Sign In & Join Server To View