# getAccessTokenSilently with ignoreCache still giving me old token

**URL:** <https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [November 10, 2023, 6:59pm UTC](https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663 "2023-11-10T18:59:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thready](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@thready](https://community.auth0.com/u/thready)\
**Post date:** [November 10, 2023, 6:59pm UTC](https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663/1 "2023-11-10T18:59:52Z")

</div>

I’m doing a rest call that adds roles to a user on the backend. After that call, I’m trying to get a new token which will have those roles injected.

```
         await rest_call();

        const refreshedAccessToken = await getAccessTokenSilently({
            scope: "openid profile email offline_access",
            ignoreCache: true,
        });

```

But even with ignoreCache, the token returned is the one that I already had locally. There is no network request to auth0 at all, so it’s for sure ignoring the “ignoreCache: true” for the call for some reason.

I’ve setup my Auth0provider with this config:

```
  const providerConfig = {
      domain: config.domain,
      clientId: config.clientId,
      useRefreshTokens: true,
      cacheLocation: "localstorage",
      onRedirectCallback,
      authorizationParams: {
          redirect_uri: window.location.origin,
          ...(config.audience ? { audience: config.audience } : null),
      },
  };

```

Any idea why ignoring cache seems to have no effect? Many thanks.

---

<div class="post-metadata">

**Author:** ![ritchike](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ritchike/32/48180_2.png) [@ritchike](https://community.auth0.com/u/ritchike)\
**Post date:** [November 13, 2023, 8:30pm UTC](https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663/2 "2023-11-13T20:30:02Z")

</div>

I am having the same problem. This used to work, but I have upgraded auth0 and made several other changes over time so hoping not to have to unwind those to figure this out. Was on @auth0/auth0-react 1.10.1 and upgraded to 2.2 among a bunch of other changes before noticing this issue

---

<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:** [November 13, 2023, 9:34pm UTC](https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663/4 "2023-11-13T21:34:45Z")

</div>

Hey there @ritchike welcome to the community!

> [@ritchike](#):
>
> Was on @auth0/auth0-react 1.10.1 and upgraded to 2.2 among a bunch of other changes before noticing this issue

Thanks for specifying the versions in use - `ignoreCache` was removed in version 2+ in favor of `cacheMode`. Please see:

> <https://github.com/auth0/auth0-react/blob/main/MIGRATION_GUIDE.md#ignorecache-on-getaccesstokensilently-has-been-removed-and-replace-with-cachemode>

@thready this may or may not be what you are running into as well.

---

<div class="post-metadata">

**Author:** ![ritchike](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ritchike/32/48180_2.png) [@ritchike](https://community.auth0.com/u/ritchike)\
**Post date:** [November 15, 2023, 12:24am UTC](https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663/5 "2023-11-15T00:24:42Z")

</div>

Thanks, switching to {cacheMode: ‘off’} solved my issue!

---

<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:** [November 15, 2023, 12:37am UTC](https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663/6 "2023-11-15T00:37:19Z")

</div>

That’s great @ritchike, thanks for confirming!

---

<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:** [November 29, 2023, 12:37am UTC](https://community.auth0.com/t/getaccesstokensilently-with-ignorecache-still-giving-me-old-token/120663/7 "2023-11-29T00:37:45Z")

</div>

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