# Error 403 - invalid\_grant - Unknown or invalid refresh token - SPA ReactJS

**URL:** <https://community.auth0.com/t/error-403-invalid-grant-unknown-or-invalid-refresh-token-spa-reactjs/89027>\
**Category:** Get Help\
**Tags:** jwt, login, auth0\
**Created:** [August 19, 2022, 2:33am UTC](https://community.auth0.com/t/error-403-invalid-grant-unknown-or-invalid-refresh-token-spa-reactjs/89027 "2022-08-19T02:33:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fquisel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fquisel/32/39412_2.png) [@fquisel](https://community.auth0.com/u/fquisel)\
**Post date:** [August 19, 2022, 2:33am UTC](https://community.auth0.com/t/error-403-invalid-grant-unknown-or-invalid-refresh-token-spa-reactjs/89027/1 "2022-08-19T02:33:32Z")

</div>

I had to enable the use of “refresh token” for it to work properly in Safari and Brave.  
I have this config in my index.js

```auto
const providerConfig = {
  domain: auth0Domain,
  clientId: auth0ClientId,
  audience: auth0Audience,
  redirectUri: auth0Redirect,
  onRedirectCallback
};

ReactDOM.render(
  <Auth0Provider
    {...providerConfig}
    useRefreshTokens={true}
    cacheLocation="localstorage"
  >
    <ThemeProvider theme={theme}>
      <Provider store={store}>
        <App />
      </Provider>
    </ThemeProvider>
  </Auth0Provider>,
  document.getElementById("root")
);

```

My config in Application Auth0.

 ![Captura de Pantalla 2022-08-18 a la(s) 22.12.46](https://global.discourse-cdn.com/auth0/original/3X/2/2/2247732f0c6aca85044fa2e3fd17ec7946d593e8.png)

Sometimes I don’t understand why the token refresh request fails  
This problem occurs occasionally and in any browser.

![Captura de Pantalla 2022-08-18 a la(s) 22.28.45](https://global.discourse-cdn.com/auth0/original/3X/2/0/2096a2661402638c20f2cefbc258ca88fb8a0622.png)

I don’t understand why it happens.

References:

- [Failed Silent Auth on page reload · Issue #101 · auth0/auth0-react · GitHub](https://github.com/auth0/auth0-react/issues/101)
- [javascript - Auth0 does not persist login on page refresh for email/password - Stack Overflow](https://stackoverflow.com/questions/63537913/auth0-does-not-persist-login-on-page-refresh-for-email-password)
- [auth0-react/FAQ.md at master · auth0/auth0-react · GitHub](https://github.com/auth0/auth0-react/blob/master/FAQ.md#1-user-is-not-logged-in-after-page-refresh)
- [Troubleshoot Renew Tokens When Using Safari](https://auth0.com/docs/troubleshoot/authentication-issues/renew-tokens-when-using-safari)

---

<div class="post-metadata">

**Author:** ![fquisel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fquisel/32/39412_2.png) [@fquisel](https://community.auth0.com/u/fquisel)\
**Post date:** [August 19, 2022, 2:49am UTC](https://community.auth0.com/t/error-403-invalid-grant-unknown-or-invalid-refresh-token-spa-reactjs/89027/2 "2022-08-19T02:49:21Z")

</div>

Status 403  
…/oauth/token in SPA

---

<div class="post-metadata">

**Author:** ![fquisel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fquisel/32/39412_2.png) [@fquisel](https://community.auth0.com/u/fquisel)\
**Post date:** [August 22, 2022, 7:14pm UTC](https://community.auth0.com/t/error-403-invalid-grant-unknown-or-invalid-refresh-token-spa-reactjs/89027/3 "2022-08-22T19:14:28Z")

</div>

The error is caused by the inactivity expiration. When enabled, a refresh\_token will expire based on a specified duration of inactivity, after which the token can no longer be used.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 21, 2022, 3:36pm UTC](https://community.auth0.com/t/error-403-invalid-grant-unknown-or-invalid-refresh-token-spa-reactjs/89027/4 "2022-12-21T15:36:11Z")

</div>


