# How to persist login with auth0-react after page refresh without localStorage?

**URL:** <https://community.auth0.com/t/how-to-persist-login-with-auth0-react-after-page-refresh-without-localstorage/65777>\
**Category:** Get Help\
**Tags:** auth0-react, localstorage, localhost, login\
**Created:** [July 7, 2021, 11:45pm UTC](https://community.auth0.com/t/how-to-persist-login-with-auth0-react-after-page-refresh-without-localstorage/65777 "2021-07-07T23:45:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Poolshark](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/poolshark/32/30418_2.png) [@Poolshark](https://community.auth0.com/u/Poolshark)\
**Post date:** [July 9, 2021, 1:58pm UTC](https://community.auth0.com/t/how-to-persist-login-with-auth0-react-after-page-refresh-without-localstorage/65777/4 "2021-07-09T13:58:44Z")

</div>

Hi there!

Sorry, I was following this thread and hoping to get more insight on how this works but unfortunately I’m even more confused now.

I basically have the same problem as @ronifintech. I have an SPA with no additional backend server and want to keep my users logged in. I’m still not sure how this would ever be possible with storing at least something either in **local storage** , **session storage** or **cookies**. Since you suggest that local storage is not an option, I was following the (multiple) guides throughout the Auth0 platform and other forums.

So what do I have so far:

1. Refresh Token Rotation seems to be the weapon of choice. I’ve set this up in my Auth0 account and implemented the **Auth0 SDK** in my project.

```auto
ReactDOM.render(
  <React.StrictMode>
    <Auth0Provider
      domain={ `${REACT_APP_AUTH0_DOMAIN}` }
      clientId={ `${REACT_APP_AUTH0_CLIENT_ID}` }
      redirectUri={ window.location.origin }
      useRefreshTokens={ true }
      cacheLocation="memory"
    >
      <App />
    </Auth0Provider>
  </React.StrictMode>,
  document.getElementById('root')
);

```

I redirect my user to the Auth0 login page for signing up or logging in. Then the login page redirects back to my SPA - so far so good. On a refresh of the page the login is lost unless I set `cacheLocation` to `localStorage` which puts basically all my tokens and IDs into the local storage (access key, client ID, …).

1. I now read further and found that I have to do a **silent authentication**? Is that right? Is that additional to the token rotation or is that a different thing?

Sorry about my probably really stupid questions but I’m super stuck and I wanna try to figure this out. Could you give me an example of what you did or of what I have to do?

Thanks!

---

_[View the full topic](https://community.auth0.com/t/how-to-persist-login-with-auth0-react-after-page-refresh-without-localstorage/65777)._
