# Session not extended by token exchange

**URL:** <https://community.auth0.com/t/session-not-extended-by-token-exchange/154092>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [November 26, 2024, 7:44pm UTC](https://community.auth0.com/t/session-not-extended-by-token-exchange/154092 "2024-11-26T19:44:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![edwindwalker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/edwindwalker/32/62156_2.png) [@edwindwalker](https://community.auth0.com/u/edwindwalker)\
**Post date:** [November 26, 2024, 7:44pm UTC](https://community.auth0.com/t/session-not-extended-by-token-exchange/154092/1 "2024-11-26T19:44:59Z")

</div>

I’m trying to implement an inactivity timer for my React SPA using the approach suggested here: [Session Lifetime Limits](https://auth0.com/docs/manage-users/sessions/session-lifetime-limits). As I have implemented it, the timer will be (re-)set each time the user obtains a new token. (That is my interpretation of the following sentence: “Each time a token is returned to the application, reset the timer.”) I am using refresh tokens, so a new access token is regularly generated through a request to the `/oauth/token` endpoint. Through some preliminary testing I’ve determined that the session is not being extended by this action. That is, calling `getAccessTokenSilently()` will throw an error with message `Login required` after the idle session lifetime has passed. This seems to conflict with the idea of the user being “inactive” or “idle”.

Client settings:

```auto
{
    "refresh_token": {
        "expiration_type": "expiring",
        "leeway": 3600,
        "token_lifetime": 3600,
        "idle_token_lifetime": 3500,
        "infinite_token_lifetime": false,
        "infinite_idle_token_lifetime": false,
        "rotation_type": "rotating"
    }
}

```

Tenant settings:

```auto
{
    "idle_session_lifetime": 1,
    "session_lifetime": 168
}

```

---

<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:** [November 26, 2024, 11:03pm UTC](https://community.auth0.com/t/session-not-extended-by-token-exchange/154092/3 "2024-11-26T23:03:51Z")

</div>

Hi @edwindwalker,

I recommend referring to our [Inactivity Timeout and Refresh Token Exchanges](https://community.auth0.com/t/inactivity-timeout-and-refresh-token-exchanges/134872) knowledge articles, which address the issue of using refresh tokens.

You may also find our [Session Management - Login Issues and Staying Logged In](https://community.auth0.com/t/session-management-login-issues-and-staying-logged-in/120975) knowledge article helpful.

Let me know if you have any follow-up questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![edwindwalker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/edwindwalker/32/62156_2.png) [@edwindwalker](https://community.auth0.com/u/edwindwalker)\
**Post date:** [November 27, 2024, 10:58am UTC](https://community.auth0.com/t/session-not-extended-by-token-exchange/154092/4 "2024-11-27T10:58:03Z")

</div>

I have reconfigured my `Auth0Provider` to not use refresh tokens and, despite regular calls to the `/authorize` endpoint, after 60 minutes I am redirected to the login page. I do not have to re-enter my details. The following error is being thrown:

 ![Screenshot 2024-11-27 at 10.48.09](https://global.discourse-cdn.com/auth0/original/3X/8/e/8e663b166e43491946936c45046feb74e9282115.png)

---

<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:** [December 4, 2024, 12:19am UTC](https://community.auth0.com/t/session-not-extended-by-token-exchange/154092/5 "2024-12-04T00:19:25Z")

</div>

Hi @edwindwalker,

Thanks for the update.

Since you are using a React SPA, you should use [silent authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication) to extend the user’s session without requiring user interaction. Refresh tokens are typically designed for regular web applications, as noted in [this documentation](https://auth0.com/docs/secure/tokens/refresh-tokens/refresh-token-rotation#:~:text=Unfortunately%2C%20long%2Dlived%20refresh%20tokens%20are%20not%20suitable%20for%20SPAs).

Thanks,  
Rueben

---

<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:** [December 18, 2024, 12:20am UTC](https://community.auth0.com/t/session-not-extended-by-token-exchange/154092/6 "2024-12-18T00:20:14Z")

</div>

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