-
Notifications
You must be signed in to change notification settings - Fork 10
Description
In the React SDK, isLoggedIn set to false on first token expiry and never back to true after a successful refresh
Description
I think the title says it all
Affects package
sdk-react
Affects versions
"node_modules/@fusionauth/react-sdk": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@fusionauth/react-sdk/-/react-sdk-2.4.0.tgz",
"integrity": "sha512-jjpsEgkVlPC8+o8qnuV8FqOJjLYMmJ8dEj7DIlT+PquCJPcrvrWkINROgqpmnHwWaF2Q1uCsx3DakJHTjoKb7g==",
"dependencies": {
"classnames": "^2.3.2"
},
Steps to reproduce
Start with this in your or or whatever.
const { isLoggedIn } = useFusionAuth()
useEffect(() => console.log(`isLoggedIn: ${isLoggedIn}`), [isLoggedIn])
Login, and you'll get userInfo: false a couple of times, followed by a userInfo: true. Then once the token expires, you'll see userInfo: false. The network tab confirms the SDK has successfully refreshed the token (and the app.at_exp cookie shows a new expiration time). And then, nothing. The state of isLoggedIn remains false.
Expected behavior
The isLoggedIn state should only be set to false if the token refresh fails, not after the first token expiration.
Community guidelines
All issues filed in this repository must abide by the FusionAuth community guidelines.
Additional context
Looking at the code, it seems that isLoggedIn is initialized to the "core value" here, and the only other setIsLoggedIn call is here, where it is set to false upon exipiration.