How to handle access token expiry client side? #6412
Unanswered
MrBond2104
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good day,
unfortunately I have some problems with my authentication.
I use Next13 with NextAuth and my own Express API with JWT Access tokens.
My main problem is the access token expiry. The session callack is executed every time the user changes or reloads a page.
But not when the user stays on the page.
For example i have some filtering, so i fetch new data with useEffect.
But what if the access token (running time 15min) expires in this time? I can't fetch any more data and get an error.
What's the best way to deal with something like this?
Another example would be a user fills out a form for 15 minutes, clicks submit, which executes a post with access token. But this one could expire.
The session will not be updated when it expires...
In connection with this, my token rotation didn't work either.... Because the rotation is only triggered with a page change or manual refresh.
Could someone please help me with this? I also have another discussion below with my code: #6347
Beta Was this translation helpful? Give feedback.
All reactions