# How to keep login session when refreshing page in SPA

**URL:** <https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858>\
**Category:** Get Help\
**Tags:** login\
**Created:** [April 9, 2021, 8:19pm UTC](https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858 "2021-04-09T20:19:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hxnam0509](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hxnam0509/32/28677_2.png) [@hxnam0509](https://community.auth0.com/u/hxnam0509)\
**Post date:** [April 9, 2021, 8:19pm UTC](https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858/1 "2021-04-09T20:19:06Z")

</div>

Hi there,  
Following the instruction on [Auth0 React SDK Quickstarts: Login](https://auth0.com/docs/quickstart/spa/react), I am able to let user login to my react SPA.  
I am using `isAuthenticated` from `useAuth0();` to check if user is logged in. This works well when user navigates among pages.  
However if user refresh browser, `isAuthenticated` return `false` , so user has to login again.  
I wanna keep login session for a period of time, and wanna rely on Auth0 to do that job without launching my own server to manage the session.  
Is there a way to do that ?

---

<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:** [April 12, 2021, 11:02am UTC](https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858/3 "2021-04-12T11:02:50Z")

</div>

Hi @hxnam0509,

There are a couple of different causes that may be resulting in your application losing authentication after the page refreshes. This article explains the two most common reasons (developer keys & blocked third-party cookies).

[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)

Let me know if the FAQ solves this!

---

<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:** [April 13, 2021, 3:54pm UTC](https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858/4 "2021-04-13T15:54:02Z")

</div>

A post was split to a new topic: [Authentication is lost after page refresh](https://community.auth0.com/t/authentication-is-lost-after-page-refresh/61030)

---

<div class="post-metadata">

**Author:** ![hxnam0509](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hxnam0509/32/28677_2.png) [@hxnam0509](https://community.auth0.com/u/hxnam0509)\
**Post date:** [April 14, 2021, 8:46am UTC](https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858/5 "2021-04-14T08:46:38Z")

</div>

Thanks so much @stephanie.chamblee , the FAQ solves my problem.

Btw I think you guys should add this FAQ to your tutorial on [Auth0 React SDK Quickstarts: Login](https://auth0.com/docs/quickstart/spa/react?_ga=2.256435848.2023869881.1618369477-1961801107.1617573113), it is difficult for beginners to find out this info. Your tutorial doesn’t seem to be complete.

---

<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:** [April 14, 2021, 10:55am UTC](https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858/6 "2021-04-14T10:55:13Z")

</div>

Hi @hxnam0509,

I’m glad that the FAQ helped get you through the blocker! Thank you for the feedback regarding the Quickstart.

---

<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, 2021, 10:55am UTC](https://community.auth0.com/t/how-to-keep-login-session-when-refreshing-page-in-spa/60858/7 "2021-04-29T10:55:26Z")

</div>

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