# Get token silently fails on non-Chrome browsers

**URL:** <https://community.auth0.com/t/get-token-silently-fails-on-non-chrome-browsers/88156>\
**Category:** Get Help\
**Created:** [August 4, 2022, 2:39am UTC](https://community.auth0.com/t/get-token-silently-fails-on-non-chrome-browsers/88156 "2022-08-04T02:39:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alvin-ec](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alvin-ec/32/36392_2.png) [@alvin-ec](https://community.auth0.com/u/alvin-ec)\
**Post date:** [August 4, 2022, 2:39am UTC](https://community.auth0.com/t/get-token-silently-fails-on-non-chrome-browsers/88156/1 "2022-08-04T02:39:03Z")

</div>

We plan to getTokenSilently on every backend api call so to extend the access-token lifetime.

Using this example as proof-of-concept [auth0-javascript-samples/01-Login at master · auth0-samples/auth0-javascript-samples · GitHub](https://github.com/auth0-samples/auth0-javascript-samples/tree/master/01-Login) the call to get new token fails on browsers like Safari, Firefox and Brave (It works fine on Chrome) with error:

```auto
Error: Login required
    at new n (auth0-spa-js.production.esm.js:1:1)
    at n.fromPayload (auth0-spa-js.production.esm.js:1:1)
    at r (auth0-spa-js.production.esm.js:1:1)

```

I added the code after line 119:

```auto
console.log('getTokenSilently', await auth0.getTokenSilently({ ignoreCache: true }));

```

snippet below

```auto
    try {
      const result = await auth0.handleRedirectCallback();

      if (result.appState && result.appState.targetUrl) {
        showContentFromUrl(result.appState.targetUrl);
      }

      console.log("Logged in!");
      console.log('getTokenSilently', await auth0.getTokenSilently({ ignoreCache: true }));
    } catch (err) {
      console.log("Error parsing redirect:", err);
    }

```

some other details:

```auto
    await auth0.loginWithRedirect({
              returnTo: 'http://localhost:3000'
            });

  auth0 = await createAuth0Client({
    client_id: <populated>,
    audience: <populated>,
    connection: <populated>,
    domain: <populated>,
    redirect_uri: "http://localhost:3000",
  });

```

If I want to get this working I have to update browser config to “allow all cookies” which is not something we plan customers to do as that is not the default setting. Is this a known bug, any workaround appreciated. Thank you.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 5, 2022, 1:09am UTC](https://community.auth0.com/t/get-token-silently-fails-on-non-chrome-browsers/88156/3 "2022-08-05T01:09:58Z")

</div>

Hello @alvin-ec welcome to the community!

> [@alvin-ec](#):
>
> Is this a known bug, any workaround appreciated.

This is unfortunately a known issue that is just due to modern browsers and cross-origin authentication - You can address this by adding a custom domain to address this [limitation](https://auth0.com/docs/authenticate/login/cross-origin-authentication#limitations).

This can also happen if the `audience` and/or `scope` is different than in the original request.

> [@Getting Silent Auth working on Safari/iOS with RefreshTokens and cacheLocation localstorage](https://community.auth0.com/t/getting-silent-auth-working-on-safari-ios-with-refreshtokens-and-cachelocation-localstorage/61059/3):
>
> 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.

The following FAQ on Custom Domains may also be helpful:

[https://community.auth0.com/t/custom-domain-configuration-common-questions/82033](https://community.auth0.com/t/custom-domain-configuration-common-questions/82033)

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 20, 2022, 1:09am UTC](https://community.auth0.com/t/get-token-silently-fails-on-non-chrome-browsers/88156/4 "2022-08-20T01:09:58Z")

</div>

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