Skip to content
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

[Question]: checking token validity before sending HTTP requests #1958

Open
Stalaktite opened this issue Jun 6, 2024 · 0 comments
Open

[Question]: checking token validity before sending HTTP requests #1958

Stalaktite opened this issue Jun 6, 2024 · 0 comments
Labels

Comments

@Stalaktite
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant