# Access token expires after token not updating in angular keycloak

**URL:** <https://forum.keycloak.org/t/access-token-expires-after-token-not-updating-in-angular-keycloak/15156>\
**Category:** Getting advice\
**Created:** [April 25, 2022, 3:43pm UTC](https://forum.keycloak.org/t/access-token-expires-after-token-not-updating-in-angular-keycloak/15156 "2022-04-25T15:43:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tharunvarshanth](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tharunvarshanth/32/5552_2.png) [@Tharunvarshanth](https://forum.keycloak.org/u/Tharunvarshanth)\
**Post date:** [April 25, 2022, 3:43pm UTC](https://forum.keycloak.org/t/access-token-expires-after-token-not-updating-in-angular-keycloak/15156/1 "2022-04-25T15:43:52Z")

</div>

Hi all  
We are using below mentioned code to update the users token when users access token is expired , in our angular application ,But the issue when calling updateToken() function , we are getting the error message in console like this (POST \*[http://localhost/auth/realms/](http://localhost/auth/realms/) master/protocol/openid-connect/token )400 BadRequest Promise rejection.

And we are configured master token in admin console like this  
\*SSO Session Idle :1hour  
\*SSO Session Idle : 1 day  
\*Access Token Lifespan : 1day

keycloakService.keycloakEvents$.subscribe({  
next: (e) =\> {  
if (e.type == KeycloakEventType.OnTokenExpired) {  
keycloakService.updateToken(20);  
}  
}  
});

Please anyone know about this issue help us

---

<div class="post-metadata">

**Author:** ![singhvivek2503](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/singhvivek2503/32/6003_2.png) [@singhvivek2503](https://forum.keycloak.org/u/singhvivek2503)\
**Post date:** [June 16, 2022, 12:11pm UTC](https://forum.keycloak.org/t/access-token-expires-after-token-not-updating-in-angular-keycloak/15156/2 "2022-06-16T12:11:43Z")

</div>

@Tharunvarshanth were you able to find a solution to this?

---

<div class="post-metadata">

**Author:** ![Tharunvarshanth](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tharunvarshanth/32/5552_2.png) [@Tharunvarshanth](https://forum.keycloak.org/u/Tharunvarshanth)\
**Post date:** [June 17, 2022, 11:55am UTC](https://forum.keycloak.org/t/access-token-expires-after-token-not-updating-in-angular-keycloak/15156/3 "2022-06-17T11:55:42Z")

</div>

yes,theoretically refresh token expire time should be greater then access token expire time , so we have maintained SSO Session Idle and SSO Session Idle same value with greater access token expiration time then above code will get’s works
