Waking up from sleep
See original GitHub issueoidc-client-ts
does not seem to handle the computer going to sleep. When the computer wakes up, typically the error that occurs is:
[SilentRenewService] _tokenExpiring: Error from signinSilent: IFrame timed out without a response
and oidc-client-ts
stops trying to silently refresh the token.
My main question is, should this be handled in my application or by oidc-client-ts
?
If I need to handle in my application, first I would need to detect this condition. My thinking is to use the Page Visibility API. Whenever the page becomes visible, I would check for a timeout problem in oidc-client-ts
. If this is detected, I would try to get oidc-client-ts
to continue its silent refreshing with UserManager.signinSilent()
.
It is possible (though unlikely) that the refresh token has timed out if the computer has been asleep for a long time. So if UserManager.signinSilent()
fails, I would try again with UserManager.signinRedirect()
however that would effectively restart my application.
Any ideas on how this can be handled?
If my application has to handle this, how could it detect that oidc-client-ts
has timed out and is no longer doing silent refreshes?
Thanks for your help.
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (12 by maintainers)
Top GitHub Comments
After thinking more about this:
As a user of this library i would expect the silent renew process to continue until the auth server responses with an error response. For the likes of iframe timeout out due to TAB/PC sleep or network not connected it shall continue/retry. This whole behavior should be default, but user should be able to disable this by a new settings parameter.
I think handling this error is very application specific. Maybe a “default” silent renew handler would be in order, but it should be possible to override/replace it completely if one needs different behavior.