# Renew access token without reference token

**URL:** <https://community.auth0.com/t/renew-access-token-without-reference-token/9959>\
**Category:** Get Help\
**Tags:** spa, renew, access-token\
**Created:** [March 11, 2018, 1:22pm UTC](https://community.auth0.com/t/renew-access-token-without-reference-token/9959 "2018-03-11T13:22:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjoskar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@tjoskar1](https://community.auth0.com/u/tjoskar1)\
**Post date:** [March 11, 2018, 1:22pm UTC](https://community.auth0.com/t/renew-access-token-without-reference-token/9959/1 "2018-03-11T13:22:06Z")

</div>

Hi,

I have the following scenario:

1. A user visits my SPA (web).
2. The user logs in and receives an access token that will expire in, let’s say, 1 hour. The token is stored in local storage.
3. An hour is passing by and the user is still using the application.
4. The user has to re-login and loses unsaved work

As I understand there are a few different solutions:

1. Refresh token. But this is not to prefer in a SPA (since there is no safe place to store the Refresh token)
2. Extend the lifetime. The problem will remain. Even if I set the lifetime to one day the user can leave the browser open and get back to work right before the time expires.
3. [Silent Authentication](https://auth0.com/docs/api-auth/tutorials/silent-authentication) but that requirer SSO which I do not use.

What is the best practice?

Ideally, I want to keep the user logged in for a week and if the user visits the site within that week the session should be extended. Meaning; if the user keeps coming back the user will be logged in forever. Is this possible?

Is it possible to get a new access token from an existing one (that is still valid)?

Thanks.

---

<div class="post-metadata">

**Author:** ![luis.rudge](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/luis.rudge/32/7073_2.png) [@luis.rudge](https://community.auth0.com/u/luis.rudge)\
**Post date:** [May 7, 2018, 9:49pm UTC](https://community.auth0.com/t/renew-access-token-without-reference-token/9959/2 "2018-05-07T21:49:34Z")

</div>

There’s two things that expire: tokens and the session.  
Even though your token might expire in 1h, your session might take longer, so you can always ask for new tokens. So, if you know that the access\_token has expired, call `webauth.checkSession` to get a new one. If it returns `login_required`, that means that the session has expired, so the user will have to login again. More info: [Auth0.js v9 Reference](https://auth0.com/docs/libraries/auth0js/v9#using-checksession-to-acquire-new-tokens)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 25, 2019, 1:04pm UTC](https://community.auth0.com/t/renew-access-token-without-reference-token/9959/3 "2019-07-25T13:04:46Z")

</div>


