Hi,
I am using auth0-react
(^2.1.0) in a vite react app, the tokens are persisted in local storage.
My access tokens have an expiration time of 90 seconds (60 seconds for browser flows).
After logging in the tokens in local storage look like this:
{
"body": {
"access_token": "[accessToken]",
"refresh_token": "[refreshToken]",
"scope": "openid profile email offline_access",
"expires_in": 90,
"token_type": "Bearer",
"audience": "https://api-stage.stack-stream.com",
"oauthTokenScope": "openid profile email offline_access",
"client_id": "QcTADJT4myGOdw9mZKp3kTBvuhFtad5e"
},
"expiresAt": 1684240206
}
Everything works fine until the access token expires. Right after expiration the local storage value gets updated to the following:
{
"body": {
"refresh_token": "[refreshToken]"
},
"expiresAt": 1684240206
}
Everytime the getAccessTokenSilently
method gets executed it will timeout with the following error message
Error: Timeout when executing 'fetch'
at auth0-spa-js.production.esm.js:1:8727
also right after the value gets updated there is a lock from the getTokenSilently
method browser-tabs-lock-key-auth0.lock.getTokenSilently
. This lock does not get lifted until the getAccessTokenSilently
method times out.
When I refresh the page everything works as expected, the local storage value gets updated to have new tokens. Also then the getAccessTokenSilently
method returns the tokens successfully.
Am I missing something here? Is this the expected behavior?
If you need any addtitional informations from me, I’m happy to provide it.