We are looking to migrate from v3 to v4 of the nextjs SDK in order to update to nextjs15 and are mostly working but running into an issue.
During our signup process we interrupt the signup flow to gather more information from the user. To work out if we need to do this the BE is attaching claims to the JWT that describe the current user state. To get these we modified the beforeSessionSaved
config to return all session information into the session, great!
The part we are having trouble with is that after the user completes the onboarding step we need to re-fetch a new access token to update the claims and let our user proceed through. We used to do this by redirecting the user to /api/auth/silent-login
after each step which would do a refresh and fetch new claims. Since this has been removed we cannot find a way to update the claims on-demand.
I have tried going down the route of using updateSession()
but this doesn’t actually do a new login to fetch new claims it just allows you to append data. We do not want to append the claims ourselves as the back-end should always be the source of truth here.
How would we go about solving this issue?