Getting Silent Auth working on Safari/iOS with RefreshTokens and cacheLocation localstorage

  • Which SDK this is regarding: e.g. @auth0/auth0-react
  • SDK Version: 1.1.0
  • Platform Version: React 16.13.1
  • Code Snippets/Error Messages/Supporting Details/Screenshots:
    Unhandled Promise Rejection: Error: Login required

Hi, I’ve been using the free tier of auth0 to authenticate my application I’m developing with my team and I cannot for the life of me figure out how to get silentAuthentication working on Safari for macOS and iOS with regards to the Intelligent Tracking Prevention (ITP).

Links among many others:

I’ve looked at lots of wiki articles and community posts and it seems like it simply doesn’t work to use useRefreshTokens and cacheLocation=“localstorage”.

Here is the code I’m using to try to achieve this solution and I’ve enabled refreshTokens in my dashboard following this guide: Configure Refresh Token Expiration


And later I use withAuth0 to consume the context and call getAccessTokenSilently. However, each time I do, I recieved a login required error on safari and iOS.

This problem makes it a little hard to scale my project as it’s embarrassing to say our solution simply doesn’t work for a large percentage of customers. Any help would be greatly appreciated!

Hi @nicholas.cole.good,

Welcome to the Community!

When you call getAccessTokenSilently are you using the same audience and scope that is set in the Auth0Provider? I’ve seen in some cases that silent auth will be required because a new scope or audience is requested after the app initiates. Silent auth won’t work when a non-custom domain is used and 3rd-party cookies are blocked.

1 Like

Hi @stephanie.chamblee!

Oh, I am using: auth0.getAccessTokenSilently({ scope: "read:current_user" })!

I just tried adding this scope to the Auth0Provider and it worked on Safari!!!

Thank you so much :smiley:

1 Like

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