HTTP interceptor make a request to /authorize every API call

Hi,

I am using the auth0-angular SDK and the AuthHttpInterceptor to inject access tokens into the authorization header for making API calls. Why does the interceptor call into /authorize for every API call I make? I did not disable any caching, using pretty much the defaults. Why does it generate a new access token every time?

Regards,
Bart

Hi @bart3,

Welcome to the Community!

A request to the /authorize endpoint will be made if a token is not found in the cache. Are you seeing this happen with each page refresh, or does this occur even without a page refresh?

Here is more info about token storage in SPAs:

https://auth0.com/docs/tokens/token-storage#browser-in-memory-scenarios

The problem occurred without page refresh. I was making API calls every 1s and each was getting authorized with a new token.

The issue I had was resolved when ID Token expiry was increased from 60s to 15min. Access token expiry was also set to a much larger value. Looks like there is some bug-ish behaviour in the SDK.

Regards,
Bart

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.