I am facing issues keeping my auth0 user in sync with the session in my NextJS application. Basically I need the user’s role and permissions to be updated when I add/remove a role or permission.
Right now I am using a role to conditionally render some pages, but after giving the user said role, the sessions in frontend (with useUser) and backend (with getSession) are unchanged. Roles and permissions are added as custom claims via Login actions.
Two questions:
Can I “force” update the session to see the custom claims of roles and permissions reflected?
Is there a better alternative for always keeping roles & permission in sync with my changes on the auth0 dashboard?
Right now I have to logout and login again to see any modifications.