# I keep getting logged out even though I have set a long session in auth0 dashboard

**URL:** <https://community.auth0.com/t/i-keep-getting-logged-out-even-though-i-have-set-a-long-session-in-auth0-dashboard/129034>\
**Category:** Get Help\
**Tags:** rules-configs, management-api\
**Created:** [March 6, 2024, 7:54am UTC](https://community.auth0.com/t/i-keep-getting-logged-out-even-though-i-have-set-a-long-session-in-auth0-dashboard/129034 "2024-03-06T07:54:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gautelorentsen](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gautelorentsen/32/51198_2.png) [@gautelorentsen](https://community.auth0.com/u/gautelorentsen)\
**Post date:** [March 6, 2024, 7:54am UTC](https://community.auth0.com/t/i-keep-getting-logged-out-even-though-i-have-set-a-long-session-in-auth0-dashboard/129034/1 "2024-03-06T07:54:56Z")

</div>

I keep getting logged out even though I have set a long session in auth0 dashboard. I use next.js.

I have set the session in the dashboard to 1 year, but I get logged out after a week. In the backend I have a function that fetches refresh and access token and updates the session based on these.  
await updateSession(req, res, {  
…session,  
accessToken: tokenData.access\_token,  
refreshToken: tokenData.refresh\_token,  
idToken: tokenData.id\_token,  
accessTokenExpiresAt:  
Math.floor(Date.now() / 1000) + tokenData.expires\_in,  
});

I can see that my appSession cookie get’s extended by a day at a time. Do I need to sync the nextjs-auth0 sdk with the auth0 configuration in some way?  
Do I need to do a re-authentication of some sort to the nextjs-auth0 sdk?

---

<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:** [July 25, 2024, 3:34pm UTC](https://community.auth0.com/t/i-keep-getting-logged-out-even-though-i-have-set-a-long-session-in-auth0-dashboard/129034/4 "2024-07-25T15:34:45Z")

</div>

Hi @gautelorentsen,

I recommend ensuring that your [configured session lifetime settings](https://auth0.com/docs/manage-users/sessions/configure-session-lifetime-settings) have set a value in minutes for the **Inactivity timeout** and **Require log in after** settings.

After doing so, you can verify that it is working correctly by making sure you maintain an active session before the **inactivity timeout** or **require login after** settings are triggered. You should notice that your session persists and does not log you out.

You might need to [silently authenticate](https://auth0.com/docs/authenticate/login/configure-silent-authentication) users if you intend to persist their session without user interaction.

Please let me know if you have any questions.

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:** [August 8, 2024, 3:35pm UTC](https://community.auth0.com/t/i-keep-getting-logged-out-even-though-i-have-set-a-long-session-in-auth0-dashboard/129034/5 "2024-08-08T15:35:11Z")

</div>

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