# Auth0-nextjs V4 migration: How to update session with new claims after logged in

**URL:** <https://community.auth0.com/t/auth0-nextjs-v4-migration-how-to-update-session-with-new-claims-after-logged-in/186190>\
**Category:** Get Help\
**Tags:** sessions, access-token\
**Created:** [May 1, 2025, 11:41am UTC](https://community.auth0.com/t/auth0-nextjs-v4-migration-how-to-update-session-with-new-claims-after-logged-in/186190 "2025-05-01T11:41:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lex.webb](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lex.webb/32/71521_2.png) [@lex.webb](https://community.auth0.com/u/lex.webb)\
**Post date:** [May 1, 2025, 11:41am UTC](https://community.auth0.com/t/auth0-nextjs-v4-migration-how-to-update-session-with-new-claims-after-logged-in/186190/1 "2025-05-01T11:41:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [May 1, 2025, 6:46pm UTC](https://community.auth0.com/t/auth0-nextjs-v4-migration-how-to-update-session-with-new-claims-after-logged-in/186190/3 "2025-05-01T18:46:57Z")

</div>

Hi @lex.webb,

Welcome to the Auth0 Community and thank you for your post!

My recommendation on how to achieve this behavior on the server would be utilizing the `getSession()` helper that can be used in Server Components, Server Routes, and Server Actions to get the session of the currently authenticated user.

Multiple example can be checked out here under our [github documentation](https://github.com/auth0/nextjs-auth0/blob/main/EXAMPLES.md).

After checking if the session exists you can initiate [silent authentication](https://github.com/auth0/nextjs-auth0/blob/main/EXAMPLES.md) by redirecting the user to the `/authorize` endpoint with `prompt=none`.

I hope this helps, so you can let me know if this does the trick for you.  
Thanks,  
Remus

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 15, 2025, 6:47pm UTC](https://community.auth0.com/t/auth0-nextjs-v4-migration-how-to-update-session-with-new-claims-after-logged-in/186190/4 "2025-05-15T18:47:32Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
