# \[SPA here\] Refresh the token updating the claims (example for updating role)

**URL:** <https://community.auth0.com/t/spa-here-refresh-the-token-updating-the-claims-example-for-updating-role/9549>\
**Category:** Get Help\
**Tags:** webhooks, claims, refresh-tokens\
**Created:** [February 21, 2018, 2:23am UTC](https://community.auth0.com/t/spa-here-refresh-the-token-updating-the-claims-example-for-updating-role/9549 "2018-02-21T02:23:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucax88x](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucax88x/32/7615_2.png) [@lucax88x](https://community.auth0.com/u/lucax88x)\
**Post date:** [February 21, 2018, 2:23am UTC](https://community.auth0.com/t/spa-here-refresh-the-token-updating-the-claims-example-for-updating-role/9549/1 "2018-02-21T02:23:28Z")

</div>

Hello guys, auth0 is so awesome 🙂

We’re playing with auth0, giving him a chance, and I have a little doubt.

ps: I’m aware refresh tokens should be forbidden (are forbidden?) on SPA

I am about to create a webhook in order to add custom roles to an user, but I was thinking:

if I change the role to an user while he’s logged, there’s no way to refresh his ‘claim’ containing the role, he has to log-off and log-in again, right? Or refreshing token would call the webhook and grabs the new role?

I’m trying to understand that expecially because having a role on claims would have a great positive performance impact, without having to query everytime I make an api call, and I need the same thing for a ‘subscription-plan policy’, so for example when my user wants to buy a subscription, I would want it to have on the claims too.

Thanks!  
Luca

-

---

<div class="post-metadata">

**Author:** ![ricardo.batista](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ricardo.batista/32/7711_2.png) [@ricardo.batista](https://community.auth0.com/u/ricardo.batista)\
**Post date:** [February 21, 2018, 7:37pm UTC](https://community.auth0.com/t/spa-here-refresh-the-token-updating-the-claims-example-for-updating-role/9549/2 "2018-02-21T19:37:06Z")

</div>

Refresh tokens are indeed not allowed when using SPAs (see [the restrictions] ([Refresh Tokens](https://auth0.com/docs/tokens/refresh-token/current#restrictions)))

When using an SPA, the only secure option is to use [Silent Authentication](https://auth0.com/docs/api-auth/tutorials/silent-authentication). This will make a request to the /authorize endpoint with prompt=none, so no user interaction will be needed, but still the [rules](https://auth0.com/docs/rules/current) will be run. [Hooks](https://auth0.com/docs/hooks/overview) at the moment are only run for signups and on the client credentials exchange. So, if you’re adding the new role in a rule, it will be available as soon as the silent authentication is successful and the claims in the token you get from that request are updated.

---

<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:** [July 25, 2019, 10:15am UTC](https://community.auth0.com/t/spa-here-refresh-the-token-updating-the-claims-example-for-updating-role/9549/3 "2019-07-25T10:15:36Z")

</div>


