# Update Access Token custom claims with Refresh Token

**URL:** <https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336>\
**Category:** Get Help\
**Tags:** custom-claims, claims, refresh-tokens\
**Created:** [April 25, 2022, 3:10pm UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336 "2022-04-25T15:10:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hector](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@hector](https://community.auth0.com/u/hector)\
**Post date:** [April 25, 2022, 3:10pm UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336/1 "2022-04-25T15:10:47Z")

</div>

Hello! We are using the React Native SDK to handle login, logout and fetching new access tokens using the refresh token.

During login we pass a query parameter to the authentication page, which is read by the Login Action flow to add this parameter as a custom claim to the access token.

The problem comes when using the refresh token to get a new access token. We have no way to pass this custom query parameter value with the refresh token to generate the new acces token with the custom claim. This means the new access tokens returned are causing invalid API calls (this claim is required).

How can we pass cusomt values to the refresh process to the new access token can be generated like it is during login? Thanks for the help.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 25, 2022, 5:25pm UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336/3 "2022-04-25T17:25:32Z")

</div>

Hi @hector,

Welcome to the Auth0 Community!

> [@hector](#):
>
> This means the new access tokens returned are causing invalid API calls (this claim is required).
> 
> How can we pass cusomt values to the refresh process to the new access token can be generated like it is during login?

Firstly, I believe that the current approach of passing a query parameter to the authentication page is not ideal for passing custom claims to grant access to your APIs. Moreover, as you observed, calling the `getAccessTokenSilently()` method will not be able to pass a query parameter.

Instead, I recommend that you configure RBAC (Role-Based Access Control) to grant your users specific `scopes` (Permissions) for your API. This way, you can specify the scopes in your `getAccessTokenSilently()` method to allow your users can make valid API calls only if they have the correct `scopes` granted to them.

See our [Configure Core Authorization Features for Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/configure-core-rbac) doc to learn more.

Please let me know if you have any questions.  
Thank you.

---

<div class="post-metadata">

**Author:** ![hector](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@hector](https://community.auth0.com/u/hector)\
**Post date:** [April 25, 2022, 7:28pm UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336/4 "2022-04-25T19:28:30Z")

</div>

Thanks for the response! So my follow-up question is, how would we pass data from the client during login and token refresh using the React Native SDK or the Auth0 API? This data is unique per user and generated upon client startup.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 25, 2022, 9:24pm UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336/5 "2022-04-25T21:24:48Z")

</div>

Hi @hector,

Thank you for your response.

You should be able to pass the data through the `scope` parameter in the request for both Login and Silent Authentication.

For example:

```auto
const accessToken = await getAccessTokenSilently({
    audience: "YOUR_API_IDENTIFIER",
    scope: "YOUR_SCOPE",
});

```

Please let me know how this goes for you.

Thanks.

---

<div class="post-metadata">

**Author:** ![hector](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@hector](https://community.auth0.com/u/hector)\
**Post date:** [April 26, 2022, 12:26am UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336/6 "2022-04-26T00:26:09Z")

</div>

Thanks, can I pass a key value pair object in my scope? I may want to pass 1 or more related parameters to the authentication endpoint to add to the access token claims.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 2, 2022, 4:31pm UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336/7 "2022-05-02T16:31:19Z")

</div>

Hi @hector,

Thank you for your response.

> [@hector](#):
>
> can I pass a key value pair object in my scope?

Yes, in the format `key:value` to reference the scopes (permissions).

If you need to pass one or more scopes, you can separate each scope with a space in the string of the request:

```auto
const accessToken = await getAccessTokenSilently({
    audience: "YOUR_API_IDENTIFIER",
    scope: "openid email profile read:users edit:users",
});

```

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:** [October 7, 2022, 12:05am UTC](https://community.auth0.com/t/update-access-token-custom-claims-with-refresh-token/82336/8 "2022-10-07T00:05:30Z")

</div>


