auth0 / auth0-react

Auth0 SDK for React Single Page Applications (SPA)
MIT License
887 stars 258 forks source link

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

Open jsaulsberry-cvet opened 1 week ago

jsaulsberry-cvet commented 1 week ago

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 commented 4 days ago

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