-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider an eager token refresh feature #52
Comments
I think this can be done manually today by calling GetUserAccessTokenAsync and pass the "force renew" flag on the options. |
It cannot be done from the cookie |
Ok, that makes sense. But we still have a way now to do that as needed/desired. Also, this is how it was done in oidc-client-js, and it caused other issues. We can discuss. |
Just wanted to add to the discussion here, as it was my ticket that led to this. We've followed the guidance around inactivity timeout (https://docs.duendesoftware.com/identityserver/v7/ui/server_side_sessions/inactivity_timeout), as we're in an industry where we'd prefer to end the sessions of inactive users as soon as we can. Some of our clients don't hit web APIs, so their interaction with the identity server is limited to receiving their ID token (and subsequently claims via user info). for these, the identity server cookie expiration will never slide, as the tokens never get refreshed, so when the session cleanup service kicks in, the user gets signed out of the client even if they're doing stuff. We added code in the cookie event handler validate principal to check for valid tokens, and refresh them if required in order to extend the session. we wanted to leverage AccessTokenManagement as its code already did everything we needed, but the call to Authenticate in AuthenticationSessionUserAccessTokenStore.GetTokenAsync would create an infinite loop. For now we've created our own extensions of this code, such as For the most part the only real difference is that this code assumes that since you have a CookieValidatePrincipalContext, you don't have to authenticate again. As an aside, I added and in This all seems to be working great at the moment. I'm not sure if its seen as totally out of scope for the AccessTokenManagement library, but I'm surprised others aren't running into the same issues we did. |
With server side sessions on IdentityServer the refresh token flow not only provides new access tokens, but it also ensure that the session on IdentityServer is kept alive.
Consider adding a feature that checks the token expiry time during the cookie principal validation and runs the refresh token flow if needed.
The text was updated successfully, but these errors were encountered: