# Refreshing page makes web request with no token in header

**URL:** <https://community.auth0.com/t/refreshing-page-makes-web-request-with-no-token-in-header/131792>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [April 11, 2024, 2:01pm UTC](https://community.auth0.com/t/refreshing-page-makes-web-request-with-no-token-in-header/131792 "2024-04-11T14:01:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott14](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@scott14](https://community.auth0.com/u/scott14)\
**Post date:** [April 11, 2024, 2:01pm UTC](https://community.auth0.com/t/refreshing-page-makes-web-request-with-no-token-in-header/131792/1 "2024-04-11T14:01:23Z")

</div>

Hi All!

We have a pretty simple website, React frontend and .NET core on the backend. We are using Auth0 and setup JWT bearer authentication.

If we go to the website ([https://mywebsite.com](https://mywebsite.com)), it will either bring us to the auth0 login screen or pass us through to the app with cached creds. From the website we can then navigate to a page, [https://mywebsite.com/Object/1](https://mywebsite.com/Object/1). That page makes a request to the backend for data.

I can see in that request that the bearer token is included in the request.

If I were to just refresh that page now, it will make the same request and will come back with a 401. I can see by examining the request, when I refresh the page, it does not include the bearer token.

How can I address this?

Thank u!

---

<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:** [April 12, 2024, 2:56pm UTC](https://community.auth0.com/t/refreshing-page-makes-web-request-with-no-token-in-header/131792/3 "2024-04-12T14:56:32Z")

</div>

Hey there @scott14 !

> [@scott14](#):
>
> If I were to just refresh that page now, it will make the same request and will come back with a 401. I can see by examining the request, when I refresh the page, it does not include the bearer token.

This is expected behavior as `auth0-react` stores tokens [in memory](https://auth0.com/docs/secure/security-guidance/data-security/token-storage#browser-in-memory-scenarios) by default and therefore not persisted across page reloads. You can look into using [getAccessTokenSilently](https://auth0.github.io/auth0-react/interfaces/Auth0ContextInterface.html#getAccessTokenSilently) when calling your API to work around this:

> <https://github.com/auth0/auth0-react/blob/main/EXAMPLES.md#call-an-api>

---

<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 26, 2024, 2:57pm UTC](https://community.auth0.com/t/refreshing-page-makes-web-request-with-no-token-in-header/131792/4 "2024-04-26T14:57:02Z")

</div>

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