Login required error when using local storage and refresh tokens
See original GitHub issueDescribe the problem
I’ve configured auth0 client to use local storage and useRefreshTokens. When I try it out in Chrome with incognito mode, where third party cookies are disabled, login_required
error is shown although the user is already logged.
What was the expected behavior?
Cookie should not be checked and token should be obtained directly according to https://auth0.com/docs/tokens/concepts/refresh-token-rotation
Reproduction
- Configure authClient as:
createAuth0Client({
...
useRefreshTokens: true,
cacheLocation: 'localstorage'
});
- Login in Chrome with third party cookies disabled
- Get token silently
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
`getTokenSilently` throws `login_required` error when waking ...
For context: I am using auth0 in a vue app with "@auth0/auth0-spa-js": "^1.12.0" with local storage cache and rotating refresh tokens.
Read more >Application Not Loading Token from LocalStorage After Sign ...
The issue happens after login and saving the token to localStorage and routes to the proper component to handle the next request. The...
Read more >Single-page application: Acquire a token to call an API
If no access token is found or the access token found has expired, it attempts to use its refresh token to get a...
Read more >Persistent login in React using refresh token rotation
There are several ways to store tokens within client sessions: in memory, via silent authentication, and in the browser's local storage. Storing ...
Read more >Refresh access tokens - Okta Developer
You request a refresh token alongside the access and/or ID tokens as part of a user's initial authentication and authorization flow.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@luisfmsouza It sounds like you might be using the
createAuth0Client
method to instantiate the SDK, which callscheckSession
internally as part of its setup. You can avoid this if you wish by instead accessing the constructor directly, which allows you do your setup manually and handle errors yourself:Does this help?
Closing this for now, but feel free to continue discussion if there’s anything else we can look into.