# How can I test my refresh token is working with React Auth0 SDK?

**URL:** <https://community.auth0.com/t/how-can-i-test-my-refresh-token-is-working-with-react-auth0-sdk/101402>\
**Category:** Get Help\
**Tags:** rotating-refresh-tokens, sessions\
**Created:** [February 27, 2023, 5:46pm UTC](https://community.auth0.com/t/how-can-i-test-my-refresh-token-is-working-with-react-auth0-sdk/101402 "2023-02-27T17:46:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason.welsh](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jason.welsh](https://community.auth0.com/u/jason.welsh)\
**Post date:** [February 27, 2023, 5:46pm UTC](https://community.auth0.com/t/how-can-i-test-my-refresh-token-is-working-with-react-auth0-sdk/101402/1 "2023-02-27T17:46:57Z")

</div>

I am finding the documentation about refresh tokens to be a little scattered an unclear. I have enabled `offline_access` in the application settings as well as in `getAccessTokenSilently()`, and tried to set the token expiry rate in the Application settings to something obvious like 20 seconds but I am still not seeing a call to get a refresh token. I am not clear on how I am supposed to verify that I am indeed getting a refresh token. I can see on the `/authorize` endpoint that I am sending `useRefreshTokens: true` in the payload, but I am not sure if I have things set up correctly.

How can I verify this is working? Should I be seeing a new request happen in the network tab? I have not come across anything in the documentation to show how to test this functionality.

---

<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:** [February 28, 2023, 1:19am UTC](https://community.auth0.com/t/how-can-i-test-my-refresh-token-is-working-with-react-auth0-sdk/101402/3 "2023-02-28T01:19:16Z")

</div>

Hello @jason.welsh !

> [@jason.welsh](#):
>
> I am not clear on how I am supposed to verify that I am indeed getting a refresh token. I can see on the `/authorize` endpoint that I am sending `useRefreshTokens: true` in the payload, but I am not sure if I have things set up correctly.

You can verify you are in fact receiving a refresh token by inspecting the call to `/token` made by the SDK in the network tab, see:

 ![Screenshot 2023-02-27 at 5.05.49 PM](https://global.discourse-cdn.com/auth0/original/3X/0/e/0e3ee98ef95c3b7db4fce45858fa75d88fded363.png)

> [@jason.welsh](#):
>
> How can I verify this is working? Should I be seeing a new request happen in the network tab?

You will see an additional call to `/token` if the flow is working, when calling `getAccessTokenSilently` for example. Additionally, you will see a successful refresh token exchange (`sertft`) in your dashboard logs:

 ![Screenshot 2023-02-27 at 5.16.50 PM](https://global.discourse-cdn.com/auth0/original/3X/5/5/55fe2645969ddaea71d175f232c54c9a7f172e41.png)

Hope this helps to clarify!

---

<div class="post-metadata">

**Author:** ![jason.welsh](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jason.welsh](https://community.auth0.com/u/jason.welsh)\
**Post date:** [February 28, 2023, 1:54pm UTC](https://community.auth0.com/t/how-can-i-test-my-refresh-token-is-working-with-react-auth0-sdk/101402/4 "2023-02-28T13:54:49Z")

</div>

Thanks for your reply, it was very helpful.

But unfortunately it confirms that if I make the settings I think I need to make to get a refresh token, I get a “consent error”. This seems to happen every time I pass offline access to the `scope` property in the params of `getAccessTokenSilently()`. I have seen a few posts about this not being allowed on `localhost` but my team needs to be able to develop[ on localhost obviously and we need to test this before pushing to a staging environment. Is there a work around for this problem?

---

<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:** [February 28, 2023, 11:16pm UTC](https://community.auth0.com/t/how-can-i-test-my-refresh-token-is-working-with-react-auth0-sdk/101402/5 "2023-02-28T23:16:32Z")

</div>

No problem, happy to help!

> [@jason.welsh](#):
>
> But unfortunately it confirms that if I make the settings I think I need to make to get a refresh token, I get a “consent error”. This seems to happen every time I pass offline access to the `scope` property in the params of `getAccessTokenSilently()`.

Do you mind outlining your use case here in a bite more detail? If you are setting `useRefreshTokens={true}` on the the `Auth0Provider` then you shouldn’t need to pass any additional scope to `getAccessTokenSilently`.

Because silent auth is a non-interactive flow, the user will have consented to any scopes previously. Some more on this below, as well as a potential workaround to getting Auth0 to accept localhost as first party:

> [@Call an API - Consent required](https://community.auth0.com/t/call-an-api-consent-required/53324/6):
>
> @Davis As Jose mentioned, a user cannot provide consent during a non-interactive flow (like getAccessTokenSilently). You will need to either use an interactive flow that will show a consent prompt, or skip user consent for first-party apps. Note: you cannot skip consent on localhost as it is never a verifiable first party app. [Although it is possible to set up a workaround to skip the consent page on localhost during development.](https://auth0.com/docs/authorization/user-consent-and-third-party-applications#skip-consent-for-first-party-applications)

---

<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:** [April 29, 2023, 12:18am UTC](https://community.auth0.com/t/how-can-i-test-my-refresh-token-is-working-with-react-auth0-sdk/101402/6 "2023-04-29T00:18:37Z")

</div>

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