Access token expiration not updated after the first refresh when using custom API #12265
Replies: 1 comment
-
Could it be as simple as ACCESS_TOKEN_LIFETIME is really short? Do you make subsequent API calls more than 10 seconds apart? If so, that'll trigger the access refresh every single time |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my Next.js project, where I am using auth.js with the credentials provider and generating access and refresh tokens with my custom API, I am encountering the following issue:
After the first access token expires, the refresh process works as expected. However, after each subsequent API call, the refresh function is triggered again. This is happening because the token.accessExpire is never updated, so it always passes the check if (Date.now() > token.accessExpire).
When I log the new accessExpire, it correctly shows a new expiration date, but for some reason, the token isn't being updated properly.
Here is my code :
The issue seems to be that token.accessExpire is not updating as expected. Any guidance on how to fix this or if I'm missing something in my flow would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions