# Unable to get login working with React using Safari and Brave

**URL:** <https://community.auth0.com/t/unable-to-get-login-working-with-react-using-safari-and-brave/113194>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [August 8, 2023, 10:28pm UTC](https://community.auth0.com/t/unable-to-get-login-working-with-react-using-safari-and-brave/113194 "2023-08-08T22:28:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brett2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brett2/32/22642_2.png) [@brett2](https://community.auth0.com/u/brett2)\
**Post date:** [August 8, 2023, 10:28pm UTC](https://community.auth0.com/t/unable-to-get-login-working-with-react-using-safari-and-brave/113194/1 "2023-08-08T22:28:37Z")

</div>

I am working on fixing the login for a React SPA app which has trouble logging in with Safari and Brave (w/ shields). I’ve gone through a bunch of community posts (some prior mine) and this, [Troubleshoot Renew Tokens When Using Safari](https://auth0.com/docs/troubleshoot/authentication-issues/renew-tokens-when-using-safari), and am still unable to get this to work.

React v18  
@auth0 react v2.2.0

How things are setup

```auto
<Auth0Provider
    domain="auth.example.com"
    clientId="Z<SCRUBBED>xyz"
    authorizationParams={{
      redirect_uri: `${window.location.origin}/login-success`,
      audience: 'https://api.example2.com,
      scopes: 'openid profile email offline_access',
    }}
    useRefreshTokens
    useFormData={false}
  >

```

LoginSuccess looks like:

```auto
const LoginSuccess = () => {
  const { user } = useAuth0();
  const { data, loading, error } = useQuery(GET_USER);
  let redirect = false;
  if (user?.email_verified === false) {
    redirect = <Navigate to="/verify-email" />;
  }
  if (!loading) {
    if (data?.users?.me) {
      redirect = <Navigate to="/dashboard" />;
    } else {
      redirect = <Navigate to="/create-profile" />;
    }
  }
...
}

```

When using Safari or Brave the `user` var above is always undefined and thus, `useQuery()` never returns a value. All of this is fine on browsers not restricting 3rd party cookies (cross site tracking).

Token rotation is enabled and needed domains have been added to the settings.

We have even setup a custom domain of `auth.example.com` and still things aren’t working on these browsers.

If Safari cross site tracking is disabled, or Brave shields are disabled, all works as expected.

I am out of ideas and am hoping someone can help me figure out where things are not setup correct.

fyi, I am not a react developer so my milage there varies.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [August 14, 2023, 3:53pm UTC](https://community.auth0.com/t/unable-to-get-login-working-with-react-using-safari-and-brave/113194/3 "2023-08-14T15:53:02Z")

</div>

Hi @brett2,

Can you try using the `cacheLocation: 'localstorage'` option in the Auth0Provider?

Here’s the doc for it: [Auth0ProviderOptions | @auth0/auth0-react](https://auth0.github.io/auth0-react/interfaces/Auth0ProviderOptions.html#cacheLocation)

---

<div class="post-metadata">

**Author:** ![brettski](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brettski/32/17955_2.png) [@brettski](https://community.auth0.com/u/brettski)\
**Post date:** [August 14, 2023, 9:49pm UTC](https://community.auth0.com/t/unable-to-get-login-working-with-react-using-safari-and-brave/113194/4 "2023-08-14T21:49:57Z")

</div>

Hi @dan.woda. Adding `cacheLocation` made no difference.

Another finding is when `useRefreshTokens` is true, regardless of `cacheLocation` setting, Safari does not work correct with or without ITP setting.

It’s only when `useRefreshTokens={false}` does Safari work, and thus only with ITP disabled. Very strange I do agree.

I am on vacation this week so responses may be a little delayed.

> [@Custom domain not correcting Safari Login issue (ITP?)](https://community.auth0.com/t/custom-domain-not-correcting-safari-login-issue-itp/113405):
>
> Following workarounds in this Auth0 reference: [Troubleshoot Renew Tokens When Using Safari](https://auth0.com/docs/troubleshoot/authentication-issues/renew-tokens-when-using-safari) We are unable to get logins to work using Safari cross site tracking enabled (ITP). Event after setting up a custom domain for auth Safari still doesn’t work. PLEASE HELP. React 18.2 SPA website using Auth0 react 2.2.0 What further information can we supply which will assist?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [August 15, 2023, 1:17pm UTC](https://community.auth0.com/t/unable-to-get-login-working-with-react-using-safari-and-brave/113194/5 "2023-08-15T13:17:15Z")

</div>

@brettski,

Thanks for the additional info. I’m going to close this topic as it looks like you have an open one on the same issue and an engineer is working with you towards a solution.

Please let me know if you need any help.

---

<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:** [August 29, 2023, 1:17pm UTC](https://community.auth0.com/t/unable-to-get-login-working-with-react-using-safari-and-brave/113194/6 "2023-08-29T13:17:22Z")

</div>

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