Refresh token, Client and Server Side conflicts #2123
Unanswered
HarunKilic
asked this question in
Help
Replies: 1 comment
-
Seems like the issue is triggered due to the server side and client side differentials. |
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
-
Hi guys
I am building application with Next and Apollo. The idea is to check and
refresh tokens
at every request and not when getting unauthorized error, as some request will respond regarding to the attachedaccess token
.Scenario:
The user has been authenticated, and the
access token
is now expired.The user makes a request that need a valid
access token
, due to expiration, it has to be refreshed.The problem:
The first token needed request finds out that the
access token
is expired, so it sends a request to the endpoint to get a new one. This goes smoothly and it will get new tokens.The second request is somehow now getting the new states, so it will also believe that the
access token
is expired, and will try to get a new token with old states. This will fail, as it will send usedrefresh token
which is invalid.Solution?
Maybe only calling the refresh method with
maxClientAge
and notgetSession/useSession
orjwt callback
.Did anyone run into something like this?
WithApollo
Next Auth
Beta Was this translation helpful? Give feedback.
All reactions