# How to handle session expiry in NextJS

**URL:** <https://community.auth0.com/t/how-to-handle-session-expiry-in-nextjs/138193>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [July 5, 2024, 9:45am UTC](https://community.auth0.com/t/how-to-handle-session-expiry-in-nextjs/138193 "2024-07-05T09:45:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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 20, 2025, 12:07am UTC](https://community.auth0.com/t/how-to-handle-session-expiry-in-nextjs/138193/3 "2025-02-20T00:07:32Z")

</div>

Hi @benfosterdev,

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

There is no build-in method in the Auth0 NextJs SDK to handle the expiration of sessions, so the approach of catching an error is the right one in this case.

A very useful example can be checked out from this [github thread](https://github.com/auth0/nextjs-auth0/issues/44#issuecomment-699487696) and in order to make the session persists after the expiry of the user’s session you can [Configure Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication).

You can fully check out this [Knowledge Article](https://community.auth0.com/t/sync-session-with-auth0-when-using-next-js/114256) which explains the premises of this particular issue.

I hope this helped.  
Thanks,  
Remus

---

_[View the full topic](https://community.auth0.com/t/how-to-handle-session-expiry-in-nextjs/138193)._
