"Error: Login required" for getAccessTokenSlienlty in `auth0-react` in Safari and Incognito windows

I’m using auth0-react of Version - 1.2.0

After successfully authenticating, I’m fetching the accessToken for the backend api using the getAccessTokenSilently -

      const token = await auth0.getTokenSilently({
        audience: "https://xxxx.api"

I’m able to retrieve token in Chrome and Firefox. But in incognito windows (in Chrome) or in Safari, there is an error - “Error: Login required”

I’ve followed other solutions with similar problem and I’ve enabled the refresh token rotation in my SPA settings -

Also in my react application I’ve added the refreshToken attribute as well -

        scope="profile email openid"

Also in my API I’ve enabled the allow offline access -

But still I’m getting the same error.

Can you guys please help me to fix the problem ?


Hi @hari1,

Welcome to the Community!

I tried to recreate the issue, but as long as I use cacheLocation="localstorage" I am unable to recreate it.

In order to help us troubleshoot, would you mind private messaging me a HAR file:

Hi @stephanie.chamblee
Thanks for responding. Appreciate it.

After some more struggle, we found and added audience=“xxxx.api” to the Auth0Provider
and then the issue is resolved.

Although you guys are doing great, the documentation needs to be improved a lot.
All the solutions I found were in the community threads.
It would be great if these options are available in the auth0-react library.

Thanks again.

1 Like

I’m glad to hear you were able to resolve the issue! I am passing your feedback on to the appropriate team. Thank you!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.