# 'Login Required' in Safari

**URL:** <https://community.auth0.com/t/login-required-in-safari/57695>\
**Category:** Get Help\
**Tags:** api\
**Created:** [February 10, 2021, 7:24pm UTC](https://community.auth0.com/t/login-required-in-safari/57695 "2021-02-10T19:24:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cl1k](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@cl1k](https://community.auth0.com/u/cl1k)\
**Post date:** [February 10, 2021, 7:24pm UTC](https://community.auth0.com/t/login-required-in-safari/57695/1 "2021-02-10T19:24:18Z")

</div>

Hello,

MacOS 10.15.7  
Safari 14.0.2

I’m having a problem requesting tokens post login with `getAccessTokenSilently()` when third-party cookies are blocked (ie Safari). I’m getting a `Login required` error.

After finding some related posts on here, I took the following steps:

- Enabled **Rotating Refresh Tokens** in the Application configuration in Auth0
- Enabled **Offline Access** in the API configuration in Auth0.
- Added `useRefreshTokens={true}` & `cacheLocation="localstorage"` to the `<Auth0Provider/>` props.

I was still getting the problem so I also tried creating a new Application and test API in Auth0, but still no bueno.

After asking a co-worker to try the app on his Linux machine, he was able to successfully request a token with third-party cookies blocked on Chrome. However, myself (on MacOS) and another co-worker who also uses MacOS, were still getting the error in Chrome and Safari.

I’ve created this test repo which I’m able to consistently reproduce the error with:

> **[GitHub - drunkenplatypus/auth-test](https://github.com/drunkenplatypus/auth-test/tree/master)**
>
> master

If anyone has any ideas I’d really appreciate it, 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 10, 2021, 8:11pm UTC](https://community.auth0.com/t/login-required-in-safari/57695/2 "2021-02-10T20:11:20Z")

</div>

Hi @cl1k,

Welcome to the Community!

Another possible cause could be the absence of an `audience` in the `Auth0Provider`. This can happen if your app is calling an external API. Please let me know if you’ve tried adding `audience`!

Thanks,

Stephanie

---

<div class="post-metadata">

**Author:** ![cl1k](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@cl1k](https://community.auth0.com/u/cl1k)\
**Post date:** [February 11, 2021, 10:16am UTC](https://community.auth0.com/t/login-required-in-safari/57695/4 "2021-02-11T10:16:08Z")

</div>

Hi @stephanie.chamblee,

Thank you for your quick response.

I added an `audience` to the `Auth0Provider` which didn’t have any effect, but I then also added `scope` and then I was able to retrieve a token using `getAccessTokenSilently()` with the same `audience` and `scope` as I specified as ‘defaults’ in the Provider.

However, when I tried to call `getAccessTokenSilently()` using the `audience` and `scope` from a different API, I was greeted with the `Login required` error once again.

Without third-party cookies, am I only able to get a token for 1 API/audience?

---

<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 11, 2021, 11:18am UTC](https://community.auth0.com/t/login-required-in-safari/57695/5 "2021-02-11T11:18:31Z")

</div>

Unfortunately, because only one API Access Token can be cached in local storage by the `Auth0Provider`, the `Login required` error will be thrown when you attempt to acquire an Access Token for a second API when third-party cookies are blocked.

To get around this, you can follow this guide to represent multiple APIs with a single logical API: [Configure Logical API for Multiple APIs](https://auth0.com/docs/authorization/represent-multiple-apis-using-a-single-logical-api?_ga=2.76060949.1255716507.1612698975-1595415333.1607347674)

Alternatively, another strategy you could use is a pattern where you progressively log into each API. For example, if trying to get a token using `getAccessTokenSilently` fails with `login_required` error, then handle that error and call `loginWithRedirect` to log the user in then fetch and cache the token.

---

<div class="post-metadata">

**Author:** ![cl1k](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@cl1k](https://community.auth0.com/u/cl1k)\
**Post date:** [February 11, 2021, 11:30am UTC](https://community.auth0.com/t/login-required-in-safari/57695/6 "2021-02-11T11:30:11Z")

</div>

Thank you again for your quick response.

I will have a look at the article you’ve linked and implement that into our application.

> only one API Access Token can be cached in local storage by the `Auth0Provider`

I think it would be beneficial to other Auth0 users if this was mentioned/highlighted in the docs. I don’t remember seeing anything like this whilst I was looking around.

---

<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 11, 2021, 11:42am UTC](https://community.auth0.com/t/login-required-in-safari/57695/7 "2021-02-11T11:42:43Z")

</div>

Thank you for the feedback! I will pass that on to the the appropriate team.

---

<div class="post-metadata">

**Author:** ![cl1k](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@cl1k](https://community.auth0.com/u/cl1k)\
**Post date:** [February 11, 2021, 3:39pm UTC](https://community.auth0.com/t/login-required-in-safari/57695/8 "2021-02-11T15:39:27Z")

</div>

No problem, here’s some more!

Since we have all of the scopes that were previously in their own APIs in 1 place it’s quite a mess. Some sorting/filtering on the scopes table would be amazing! Ctrl-f will keep us going for now.

---

<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 11, 2021, 3:42pm UTC](https://community.auth0.com/t/login-required-in-safari/57695/9 "2021-02-11T15:42:42Z")

</div>

I think that would be a great product request for our brand new Feedback category: [Feedback - Auth0 Community](https://community.auth0.com/c/feedback/95)

The requests are reviewed by our product team, and members of the Community can vote on ideas they support.

---

<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 26, 2021, 3:43pm UTC](https://community.auth0.com/t/login-required-in-safari/57695/10 "2021-02-26T15:43:15Z")

</div>

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