# Persisting login on refresh with refresh token rotation

**URL:** <https://community.auth0.com/t/persisting-login-on-refresh-with-refresh-token-rotation/56904>\
**Category:** Get Help\
**Tags:** login, auth0\
**Created:** [January 27, 2021, 7:39pm UTC](https://community.auth0.com/t/persisting-login-on-refresh-with-refresh-token-rotation/56904 "2021-01-27T19:39:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hermit](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hermit/32/25430_2.png) [@Hermit](https://community.auth0.com/u/Hermit)\
**Post date:** [January 27, 2021, 7:39pm UTC](https://community.auth0.com/t/persisting-login-on-refresh-with-refresh-token-rotation/56904/1 "2021-01-27T19:39:29Z")

</div>

Hi, i’m new to auth0. so i have this issue with persisting login on my react app. i’m having this issue for a week, and i’m using [auth0-react](https://github.com/auth0/auth0-react) library.

So the problem is auth0 is never persisting my login even if i try to run on auth0 React-sample app and connect it with my own auth0 dashboard. the only way i found to persist my login is to save it on localstorage by adding `cacheLocation="localstorage"` props on my `Auth0Provider` component, i know about the exposure to XSS attack, and i don’t actually want to apply this way. am i missing something? can someone enlighten me?

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [January 27, 2021, 8:02pm UTC](https://community.auth0.com/t/persisting-login-on-refresh-with-refresh-token-rotation/56904/3 "2021-01-27T20:02:25Z")

</div>

Hi @Hermit,

You may find these topics helpful:

> [@Trying the new Refresh Token Rotation in a React SPA. Are 3rd party cookies supposed to be required?](https://community.auth0.com/t/trying-the-new-refresh-token-rotation-in-a-react-spa-are-3rd-party-cookies-supposed-to-be-required/41151):
>
> Nice to see Refresh Token Rotation shipped today, congrats Auth0 team! So I’m trying to test it out using @auth0/auth0-spa-js v1.7.0 on a minimal React SPA ([deploy](https://auth0-react-spa.surge.sh/), [repo](https://github.com/onpaws/auth0-react-spa)) carefully following what I think should be the relevant [quickstart](https://auth0.com/docs/quickstart/spa/react) from the docs. I used create-react-app + TypeScript and things are pretty vanilla, here’s the refresh token [opt-in](https://github.com/onpaws/auth0-react-spa/blob/71346fb7219ef92f13b57d74c7bdaa484bc5d688/src/index.tsx#L26) OK, so here’s the GIF of what’s going on: TL, DR: 3rd party cookies appear to be required for ‘silent auth’ aka the refresh butt…

[https://community.auth0.com/t/why-is-authentication-lost-after-refreshing-my-single-page-application/56276](https://community.auth0.com/t/why-is-authentication-lost-after-refreshing-my-single-page-application/56276)

This behavior is caused by the browser blocking third-party cookies during [silent authentication](https://auth0.com/docs/authorization/configure-silent-authentication). Items stored in memory are lost on page refresh, including the Access Token and Refresh Token stored there. When this happens, the SDK will use silent authentication with an iframe and pass third-party cookies. However, as you have observed, third-party cookies are blocked by many browsers. You can use Auth0’s [Custom Domain](https://auth0.com/docs/custom-domains) functionality to avoid this issue without using local storage.

---

<div class="post-metadata">

**Author:** ![Hermit](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hermit/32/25430_2.png) [@Hermit](https://community.auth0.com/u/Hermit)\
**Post date:** [January 27, 2021, 8:17pm UTC](https://community.auth0.com/t/persisting-login-on-refresh-with-refresh-token-rotation/56904/4 "2021-01-27T20:17:08Z")

</div>

firstly, thank you for replying.  
now i get it. i’m gonna look into these discussion, so in summary with custom domain i can bypass this third-party cookies issue then. okay i’m also gonna look to this custom domain, thanks again.

---

<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:** [February 11, 2021, 8:17pm UTC](https://community.auth0.com/t/persisting-login-on-refresh-with-refresh-token-rotation/56904/5 "2021-02-11T20:17:22Z")

</div>

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