# How do SPA access token expires when used against custom API to authenticate

**URL:** <https://community.auth0.com/t/how-do-spa-access-token-expires-when-used-against-custom-api-to-authenticate/78643>\
**Category:** Get Help\
**Created:** [February 21, 2022, 11:29am UTC](https://community.auth0.com/t/how-do-spa-access-token-expires-when-used-against-custom-api-to-authenticate/78643 "2022-02-21T11:29:00Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 28, 2022, 10:40pm UTC](https://community.auth0.com/t/how-do-spa-access-token-expires-when-used-against-custom-api-to-authenticate/78643/3 "2022-02-28T22:40:33Z")

</div>

Hi @Karunamay,

Thanks for reaching out to the Auth0 Community!

First, you can manage your access token lifetime settings by going to your [Auth0 Dashboard \> Applications \> APIs](https://manage.auth0.com/#/apis) and clicking on your API. On the settings page, there is the option to configure the **Token Expiration (Seconds)** for your access tokens.

After doing so, you can control when the access token expires.

Note that when using the `getAccessTokenSilently()` method, you are using [silent authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication) which leverages the use of refresh tokens to refresh the user’s login session without prompting for credentials again.

In your case, using the `getAccessTokenSilently()` method would refresh the expiration of an access token that has access to a specific resource server (API).

> [@Karunamay](#):
>
> What will be the workaround if I don’t want the last token to remain to validate.

Access tokens cannot be invalidated: they are designed to be self-contained, not requiring a check with Auth0 to validate, so there is no way to invalidate them.

For this reason, access tokens should have a short lifetime. [[credit to John Gately’s post]](https://community.auth0.com/t/invalidating-an-access-token-when-user-logs-out/48365/2)

Given that, you could consider setting a low Token Expiration time for the access token while keeping the same refresh token expiration time. This way, you can selectively call silent auth to get a new access token to gain access to the API.

> **[Update Access Token Lifetime](https://auth0.com/docs/secure/tokens/access-tokens/update-access-token-lifetime)**
>
> Describes how to update the access token lifetime for an API using the Auth0 Dashboard.

Hoped this addresses your concerns.

Please feel free to reach out if you have additional questions.

Thank you.

---

_[View the full topic](https://community.auth0.com/t/how-do-spa-access-token-expires-when-used-against-custom-api-to-authenticate/78643)._
