Auth0-spa-js: isAuthenticated method returns always false

Created on 20 May 2020  路  6Comments  路  Source: auth0/auth0-spa-js

Description

I am trying to setup refresh token rotation in a react application. I manage to create the Auth0Client, login and get to token with getTokenSilently but isAuthenticated, getUser or getIdTokenClaims are not working

Reproduction

I was making my tests with the react sample app. Everything works fine below the version 1.7.0. I start to have the issues described above after the refresh token rotation implementation.

Is it an issue with the auth0 configuration? I did make the change for the rotating refresh token behavior

bug

Most helpful comment

Setting token expiration to 60 seconds solved my problem also. Thanks to everyone for your help.

All 6 comments

Hi @szilagyikinga - thanks for your report. Do you have a sample application running anywhere we can look at to debug? Or can you show us any code?

Sounds similar to the issue that I came across whilst trying to reproduce issue #480. It occurred for me when the API Token Expiration period was set to a value of less than 60 seconds.

Hi, thanks for you answer. @JonathanHarvey I will check with 60 and let you know!

I have a similar issue but only during cypress tests (it always returns false in tests but works fine otherwise). Did anyone encounter this during cypress tests?

馃憢 we have identified an issue where methods like isAuthenticated and getUser don't behave properly when the token expiry is less than 60 seconds. We're working on a fix for the next version, but in the meantime the workaround is to use an expiry of 60 seconds or more, if possible.

Setting token expiration to 60 seconds solved my problem also. Thanks to everyone for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wrightwriter picture wrightwriter  路  7Comments

patrickcorrigan picture patrickcorrigan  路  3Comments

yirenlu92 picture yirenlu92  路  4Comments

Benjathing picture Benjathing  路  5Comments

jgbpercy picture jgbpercy  路  7Comments