oidc-client-ts icon indicating copy to clipboard operation
oidc-client-ts copied to clipboard

Add support to define JsonService timeout

Open Badisi opened this issue 1 year ago • 4 comments

Given the following use case:

  1. App starts
  2. User is not logged in
  3. A signin silent with iframe is triggered (and awaited because if it fails, user won't be allowed to go further)
  4. Down the road a call to metadataService._getMetadataProperty("authorization_endpoint") is made
  5. Then a call to jsonService.fetchWithTimeout()

From there, if the identity provider is not reachable, the fetch call will timed out only after 90s (depends on web browser implementation). But because 3. was awaited, the app is also frozen for 90s - nothing happens, maybe a white screen, and user is left in the unknown..

In such a case it would be nice to be able to define the timeout ourselves, to reduce the awaiting time. (something like silentRequestTimeoutInSeconds)

Badisi avatar Feb 23 '24 17:02 Badisi

not sure if that is easily possible: within _getMetadataProperty we do not know that we are in the silent renew context...

pamapa avatar Feb 26 '24 14:02 pamapa

I was more thinking about a global setting instead of one specifically designed for the silent renew. Something generic, like : requestTimeoutInSeconds.

What do you think ?

Badisi avatar Feb 26 '24 20:02 Badisi

What do you think ?

We can do so if it help you.

pamapa avatar Feb 28 '24 08:02 pamapa

I had a stab at this in #1430. Is this along the lines that you were thinking?

dbfr3qs avatar Mar 06 '24 23:03 dbfr3qs