# Update user after calling updateSession in Next.js

**URL:** <https://community.auth0.com/t/update-user-after-calling-updatesession-in-next-js/96328>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [December 13, 2022, 7:10am UTC](https://community.auth0.com/t/update-user-after-calling-updatesession-in-next-js/96328 "2022-12-13T07:10:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandon2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brandon2/32/33461_2.png) [@brandon2](https://community.auth0.com/u/brandon2)\
**Post date:** [December 13, 2022, 7:10am UTC](https://community.auth0.com/t/update-user-after-calling-updatesession-in-next-js/96328/1 "2022-12-13T07:10:48Z")

</div>

In my backend I have(/api/add-db-users.ts):

```auto
 await updateSession(req, res, {
      ...session,
      user: { ...session.user, 'https://localhost:3000.com/appmetadata': { localUserCreated: true } },
    })
    const session2 = await getSession(req, res)
    console.log('session2', session2)

```

session2 shows the updated appmetadata property. But when I call,

```auto
const session = await getSession(req, res)

```

anywhere else in the app, it has the old data. if I sign out then back in, the data is there.

How can I update the appmetadata field and get that updated value throughout my Next.js app?

I’m using

```auto
"@auth0/nextjs-auth0": "^2.0.0",
"next": "13.0.2",

```

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [December 23, 2022, 5:53pm UTC](https://community.auth0.com/t/update-user-after-calling-updatesession-in-next-js/96328/3 "2022-12-23T17:53:57Z")

</div>

Hi @brandon2,

Welcome to the Auth0 Community!

> [@brandon2](#):
>
> anywhere else in the app, it has the old data. if I sign out then back in, the data is there.

This is an expected behavior. To get the user’s latest state, I recommend [configuring Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication). This way, you can get new tokens with the freshest data and without any user interaction.

Please let me know if you have any questions or need help with implementation.

Thanks,  
Rueben

---

<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:** [January 6, 2023, 5:54pm UTC](https://community.auth0.com/t/update-user-after-calling-updatesession-in-next-js/96328/4 "2023-01-06T17:54:59Z")

</div>

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