angular-auth-oidc-client icon indicating copy to clipboard operation
angular-auth-oidc-client copied to clipboard

[Question]: checking token validity before sending HTTP requests

Open Stalaktite opened this issue 1 year ago • 2 comments

What Version of the library are you using? I'm using version 15.0.3 with silent renew

Question Hello, On my Angular frontend app I have silent renew working properly with a third party auth server, and tokens are correctly added to my HTTP headers for backend queries thanks to the HTTP interecptor included with the library.

The only problem I get is after a long browser inactivity (for example, computer in sleep mode for an hour) when the Angular app wakes up it sends queries to the backend to update the data, using an expired token, while - in parallel - the silent renew is being called. As a result, I get error messages from my backend for a very short period of time and I have to ignore them and/or find a way to replay the query by catching 401 HTTP errors.

Is there any option to force the HTTP interceptor to check the token validity before each call, and delay the queries if it is invalid? Alternatively, what would be the best approach to check for token validity, say for example in another chained interceptor, to manually delay any queries while the token is being refreshed?

Thanks for your help, Antoine

Stalaktite avatar Jun 06 '24 13:06 Stalaktite

Did you find any solution?

alinmateutdev avatar Mar 31 '25 12:03 alinmateutdev

Did you find any solution?

Hello, No I didn't (yet) and had to move on to many other issues. Currently the problem persists, and we're going to production in a few weeks... I was hoping to find someone facing the same issue :p

Stalaktite avatar Apr 03 '25 15:04 Stalaktite