Perditus
Perditus•14mo ago

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.
9 Replies
Perditus
PerditusOP•14mo ago
any hopes?
FFO
FFO•14mo ago
Hm can you elaborate what you are trying to do? I am not sure I understand 😉
Perditus
PerditusOP•14mo ago
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
FFO
FFO•14mo ago
Hm, does that happen if you call the userinfo endpoint?
Perditus
PerditusOP•14mo ago
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!
FFO
FFO•13mo ago
Oh, how? Mind sharing for the community? I give you a 🥨 in return 😂 Fair that is something we could improve 😅
Unknown User
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
FFO
FFO•10mo ago
Oh well that is not nice, yeah @peintnermax have you seen that?
Unknown User
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?