# Force JWT refresh after modifying app metadata included in token

**URL:** <https://community.auth0.com/t/force-jwt-refresh-after-modifying-app-metadata-included-in-token/54177>\
**Category:** Get Help\
**Created:** [December 1, 2020, 9:59pm UTC](https://community.auth0.com/t/force-jwt-refresh-after-modifying-app-metadata-included-in-token/54177 "2020-12-01T21:59:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![clee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/clee/32/12934_2.png) [@clee](https://community.auth0.com/u/clee)\
**Post date:** [December 1, 2020, 9:59pm UTC](https://community.auth0.com/t/force-jwt-refresh-after-modifying-app-metadata-included-in-token/54177/1 "2020-12-01T21:59:56Z")

</div>

Hi,

I am trying to link between application account and auth0 accounts so that the generated auth0 token will include a reference I need. However this reference is only added upon creation meaning that the currently active token will not contain it even though the token is valid. I am wondering if there is a way that I can force the token to regenerate so that subsequent calls will use a token that includes the newly added reference.

My implementation has a restriction that means that I cannot have Auth0 kick this all off as an hook so that rules out pre or post sign-up calls.

Requirements:

1. When the user attempts to use my app a user is created on our systems for it and the reference is then passed to auth0 in the app metadata
2. There is a rule active which will add the reference mentioned above into the token (however this will not be part of already created tokens which seem to not time out for x amount of time)

I have seen a similar question on the forums but am unsure if it would work for my needs:

> [@Force getTokenSilently to get a new token](https://community.auth0.com/t/force-gettokensilently-to-get-a-new-token/46380):
>
> Within a SPA using Authorization Code Flow with PKCE, let’s say I [create a rule to add some roles](https://auth0.com/docs/authorization/concepts/sample-use-cases-rules#add-user-roles-to-tokens) to my access-token so that my backend API doesn’t need to make a call to Auth0 with each request in order to retrieve the roles for the user. Now let’s say that an employee calls his boss and asks for an extra privilege in the application, so the boss changes the employee’s role to give those privileges. How do I get that new role into the employee’s access token without the employee needing to l…

Would appreciate any recommendations or extra information anyone could provide around forcing a switch to a newly generated token preferably silently so that the user does not know that the token has been regenerated (they don’t need to re-login)

Thanks in advance for any help!

---

<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:** [December 2, 2020, 9:46pm UTC](https://community.auth0.com/t/force-jwt-refresh-after-modifying-app-metadata-included-in-token/54177/3 "2020-12-02T21:46:36Z")

</div>

Hi @clee,

Welcome to the Community!

You can use the `ignoreCache` option to force a new token refresh. Checkout the doc for it:

[https://auth0.github.io/auth0-spa-js/interfaces/gettokensilentlyoptions.html#ignorecache](https://auth0.github.io/auth0-spa-js/interfaces/gettokensilentlyoptions.html#ignorecache)

---

<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:** [December 30, 2020, 11:04pm UTC](https://community.auth0.com/t/force-jwt-refresh-after-modifying-app-metadata-included-in-token/54177/4 "2020-12-30T23:04:14Z")

</div>

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