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

**URL:** <https://community.auth0.com/t/error-login-required-for-getaccesstokenslienlty-in-auth0-react-in-safari-and-incognito-windows/57073>\
**Category:** Get Help\
**Tags:** auth0-react\
**Created:** [January 31, 2021, 9:38am UTC](https://community.auth0.com/t/error-login-required-for-getaccesstokenslienlty-in-auth0-react-in-safari-and-incognito-windows/57073 "2021-01-31T09:38:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hari1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hari1/32/27280_2.png) [@hari1](https://community.auth0.com/u/hari1)\
**Post date:** [January 31, 2021, 9:38am UTC](https://community.auth0.com/t/error-login-required-for-getaccesstokenslienlty-in-auth0-react-in-safari-and-incognito-windows/57073/1 "2021-01-31T09:38:38Z")

</div>

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` -

```auto
      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 -

 ![Screen Shot 2021-01-31 at 3.02.51 PM](https://global.discourse-cdn.com/auth0/original/3X/8/2/82570d02d4f4d78d547ef8e024586a44bb98f0ec.png)

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

```auto
      <Auth0Provider
        domain="xxxx.au.auth0.com"
        clientId="xxxxxxx"
        redirectUri={"https://polite-goat-11.loca.lt"}
        scope="profile email openid"
        useRefreshTokens={true}
        cacheLocation="localstorage"
        onRedirectCallback={onRedirectCallback}
      >

```

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

 ![Screen Shot 2021-01-31 at 3.06.54 PM](https://global.discourse-cdn.com/auth0/original/3X/b/7/b78e18d9137d70a506402040bf6adef093c98e43.png)

But still I’m getting the same error.

Can you guys please help me to fix the problem ?

Thanks

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [February 2, 2021, 6:31pm UTC](https://community.auth0.com/t/error-login-required-for-getaccesstokenslienlty-in-auth0-react-in-safari-and-incognito-windows/57073/3 "2021-02-02T18:31:12Z")

</div>

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:

> **[Generate and Analyze HAR Files](https://auth0.com/docs/troubleshoot/troubleshooting-tools/generate-and-analyze-har-files?_ga=2.77766740.1169584547.1612177227-1595415333.1607347674)**
>
> Learn how to troubleshoot with HAR files and steps to generate a HAR file.

---

<div class="post-metadata">

**Author:** ![hari1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hari1/32/27280_2.png) [@hari1](https://community.auth0.com/u/hari1)\
**Post date:** [February 2, 2021, 6:46pm UTC](https://community.auth0.com/t/error-login-required-for-getaccesstokenslienlty-in-auth0-react-in-safari-and-incognito-windows/57073/4 "2021-02-02T18:46:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [February 2, 2021, 7:36pm UTC](https://community.auth0.com/t/error-login-required-for-getaccesstokenslienlty-in-auth0-react-in-safari-and-incognito-windows/57073/5 "2021-02-02T19:36:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 17, 2021, 7:37pm UTC](https://community.auth0.com/t/error-login-required-for-getaccesstokenslienlty-in-auth0-react-in-safari-and-incognito-windows/57073/6 "2021-02-17T19:37:24Z")

</div>

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