Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User is returned undefined and isAUthenticated with false when logging into the same browser with different users #810

Open
6 tasks done
jsaulsberry-cvet opened this issue Oct 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jsaulsberry-cvet
Copy link

Checklist

Description

When switching between different auth0 users within the same browser, the user from useAuth0() will return undefined and the isAuthenticated will return false, even after the user has successfully authenticated with the loginWithRedirect function. This occurs when using the cacheLocation is set to memory

Reproduction

  1. Setup an auth0 provider with cacheLocation='memory' useRefreshTokens={true} and useRefreshTokensFallback={true}
  2. Use a chrome or microsoft edge browser and authenticate a user and switch between several auth0 accounts.
  3. You should notice that after proceeding through the loginWithRedirect and being directed to the client application that intermittently, the user will still be undefined and the isAuthenticated will be false.

Additional context

No response

auth0-react version

2.2.0

React version

18.3.1

Which browsers have you tested in?

Chrome, Edge

@jsaulsberry-cvet jsaulsberry-cvet added the bug Something isn't working label Oct 9, 2024
@jsaulsberry-cvet
Copy link
Author

We are noticing that this has a higher rate of occurrence when the browser blocks third party cookies

@nandan-bhat
Copy link
Contributor

Hi @jsaulsberry-cvet

Can you confirm if this issue occurs only when switching between different users? Additionally, could you share how the onRedirectCallback is being handled in your application?

Just a quick note: if cacheLocation is set to memory, the user information will not persist after a page reload. However, I understand that your use case might differ in this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants