question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Waking up from sleep

See original GitHub issue

oidc-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:closed
  • Created 2 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
pamapacommented, Dec 13, 2021

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.

2reactions
longsleepcommented, Dec 10, 2021
  • Should we move this into oidc-client-ts?

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Insomnia: How do I stay asleep? - Mayo Clinic
Waking up in the middle of the night is called insomnia, and it's a common problem. Mid-sleep awakenings often occur during periods of...
Read more >
Waking up in the middle of the night: Causes and remedies
Waking up in the middle of the night is common. However, if it occurs often, it may signal the presence of an underlying...
Read more >
8 Reasons You're Waking Up at Night, and How to Fix Them
8 Reasons You're Waking Up Mid-Sleep, and How to Fix Them · 1. Your room is too hot, cold, noisy, or bright. ·...
Read more >
Why You Wake Up At the Same Time Every Night
Waking during the night could be due to a variety of factors and may resolve with simple lifestyle changes, such as maintaining a...
Read more >
Why do I wake up at the same time every night?
Your sleep patterns. Our sleep pattern mostly depends on our circadian rhythm and homeostatic sleep drive (the bodily mechanism that regulates ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found