Refresh token renewal
See original GitHub issueWhile the library handles Access Token refreshing with silent renew, it doesn’t take into account the Refresh Token expiration time at refresh_expires_in
.
https://github.com/authts/oidc-client-ts/blob/8d8a700b23a2fffdada0b3ecaf271bc16a74759d/src/UserManager.ts#L226-L232
Assuming the user either sets automaticSilentRenew
or uses events to do the same, this forces a constant Access Token refresh cycle when Refresh Token expiration time is less than accessTokenExpiringNotificationTimeInSeconds
, since Access Token expiration time is limited by the Refresh Token expiration time.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
What Are Refresh Tokens and How to Use Them Securely
Once they expire, client applications can use a refresh token to "refresh" the access token. That is, a refresh token is a credential...
Read more >Refresh Tokens - OAuth 2.0 Simplified
Access tokens can expire for many reasons, such as the user revoking an app, or if the authorization server expires all tokens when...
Read more >Refresh a Token - Box Developer Documentation
A Refresh Token is valid for 60 days and can be used to obtain a new Access Token and Refresh Token only once....
Read more >Does the refresh token expire and if so when? - Stack Overflow
Refresh tokens will expire X days (or hours) after their creation. Depending on your security requirements this expiration will be 1 month ...
Read more >Microsoft identity platform refresh tokens
Refresh tokens have a longer lifetime than access tokens. The default lifetime for the refresh tokens is 24 hours for single page apps...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I once reported the same issue with the previous library version (different scenario though) : oidc-client-js#948
Issue is still relevant with
oidc-client-ts
and @atomicbrainman’s proposal to fix it seems the way to go.@longsleep
It seems at least Keycloak does support it, I don’t know about the others.
And actually, we don’t need it to detect a session that is bound to expire soon.
Also, there are no errors when refreshing the token.
Let’s use an example to clarify the issue:
Say, we have an auth server with the following setup:
And the user:
automaticSilentRenew: true
andaccessTokenExpiringNotificationTimeInSeconds: 60
The client does the following:
Step 4 is the issue here. On step 3 we can detect that the returned Access Token has an expiration time less than what is set in
accessTokenExpiringNotificationTimeInSeconds
and do something to prevent step 4, e.g. logout the user immediately.A simple way to reproduce the issue would be to setup your client with a very large
accessTokenExpiringNotificationTimeInSeconds
, e.g. set it to1000000