`getAccessTokenSilently` logs user out when in private mode or icognito URGENT

Hello, I am using custom domain and everything works well with third party cookies and so on…

SDK used: auth0 for react SDK

But my problem is I have a use case where I need to write user_metadata, when I get an getAccessTokenSilently, the session breaks and logs the user out for some reason, why is this happening?

Everything works well in normal browsers and normal modes
My settings

  <Auth0Provider
      clientId={config.clientID}
      domain={config.customDomain}
      redirectUri={window.location.origin}
      scope={config.scope}
      useRefreshTokens
      cacheLocation="localstorage"
    >
      {children}
    </Auth0Provider>
  )
1 Like

I have been noticing this too

for some reason it only occurs on iOS chrome or Safari and not desktop chrome. not sure what the difference could be, but since @milos.spasovski is noticing it private/incognito, could be something related to 3rd party cookies?

my situation:

React SPA,
user logs in,
isAuthenticated says true and i can get user information
getAccessTokenSilently() runs because i have to get API calls, and that somehow invalidates the login,
and then isAuthenticated starts saying false

my issue ended up arising from the getAccessTokenSilently had different options (audience, scope) from the provider settings.
so the user logs in with the provider (default settings), you get isAuthenticated = true,
then you call getAccessTokenSilently({audience, scope}) with something maybe different for audience or scope, and it makes the original isAuthenticated = false

see thread here isAuthenticated and user are false after successful login · Issue #100 · auth0/auth0-react · GitHub