# Expiration for session not working as expected, Nextjs

**URL:** <https://community.auth0.com/t/expiration-for-session-not-working-as-expected-nextjs/117234>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [September 27, 2023, 11:42am UTC](https://community.auth0.com/t/expiration-for-session-not-working-as-expected-nextjs/117234 "2023-09-27T11:42:59Z")\
**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:** [September 27, 2023, 11:42am UTC](https://community.auth0.com/t/expiration-for-session-not-working-as-expected-nextjs/117234/1 "2023-09-27T11:42:59Z")

</div>

Hi,

I have tried to set both the inactivity timeout and the Require log in after values to a low time frame. I also tried to set Token Expiration under Token settings to the same amount.

It is an Nextjs application.  
It will not log out automatically.  
When I look at the appSession cookie it is set to a time longer into the future than expected.

Additional info. This is a project that I recently took over, so I didn’t set up the Auth0. Also meaning that I’m not 100% familiar with either the project or the auth set up.  
Appreciate all help and guidance!

---

<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:** [February 25, 2025, 6:35pm UTC](https://community.auth0.com/t/expiration-for-session-not-working-as-expected-nextjs/117234/4 "2025-02-25T18:35:36Z")

</div>

Hi @gautelorentsen,

Welcome back to the Auth0 Community and sorry for the late reply.

In NextJs the appSession cookie is still valid after a successful logout since this app session cookie is stateless. This is the expected behavior and there is no built in handler for this use-case in the Next.js SDK, however [silent authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication) can be configured. Please check out the guidelines from our [Knowledge Article](https://community.auth0.com/t/sync-session-with-auth0-when-using-next-js/114256) on how to sync sessions with Auth0 when using the NextJS SDK.

I would also definitely recommend having a look over this [community post](https://community.auth0.com/t/issues-with-auth0-nextjs-sess) for more details and solutions regarding your issue.

I hope this helped.  
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:** [March 11, 2025, 6:35pm UTC](https://community.auth0.com/t/expiration-for-session-not-working-as-expected-nextjs/117234/5 "2025-03-11T18:35:54Z")

</div>

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