# Refresh token expiration time does not renew on usage

**URL:** <https://forum.keycloak.org/t/refresh-token-expiration-time-does-not-renew-on-usage/21115>\
**Category:** Configuring the server\
**Tags:** token-exchange\
**Created:** [March 28, 2023, 7:43am UTC](https://forum.keycloak.org/t/refresh-token-expiration-time-does-not-renew-on-usage/21115 "2023-03-28T07:43:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![inver8](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/inver8/32/8077_2.png) [@inver8](https://forum.keycloak.org/u/inver8)\
**Post date:** [March 28, 2023, 7:43am UTC](https://forum.keycloak.org/t/refresh-token-expiration-time-does-not-renew-on-usage/21115/1 "2023-03-28T07:43:25Z")

</div>

Hello, I’m studying keycloak and got into a strange situation when renewing an access token.

After authorization and receiving access and refresh tokens. The refresh token expiration time is specified as specified in the settings - 600 sec:

```auto
{
    "access_token": "...",
    "expires_in": 300,
    "refresh_expires_in": 600,
    "refresh_token": "...",
    "token_type": "Bearer",
    "not-before-policy": 0,
    "session_state": "fd75aefd-5330-45a2-a21a-3e54a157d5c9",
    "scope": "profile email"
}

```

but when i do refresh request, refresh token expiration time `refresh_expires_in` is still countdown:

```auto
    "expires_in": 300,
    "refresh_expires_in": 574,

```

and when `refresh_expires_in` becomes less than `expires_in` new access token created already with lesser expiration time, eventually the tokens become invalid and refresh fails:

```auto
    "expires_in": 115,
    "refresh_expires_in": 115,

```

realm settings:

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/2/27b2c5a17788f1452ffabaf8ef208db412040c93.png)

How can I make it so that when refreshing access token, the refresh token is also completely renewed with his expiration time?

---

<div class="post-metadata">

**Author:** ![nick2015](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@nick2015](https://forum.keycloak.org/u/nick2015)\
**Post date:** [February 20, 2024, 7:01am UTC](https://forum.keycloak.org/t/refresh-token-expiration-time-does-not-renew-on-usage/21115/2 "2024-02-20T07:01:21Z")

</div>

SSO Session Max should be great than SSO Session Idle  
and the same  
Client Session Max should be great than Client Session Idle  
Otherwise the scenario will be occured
