Sequential requests made with auth0 spa js result in multiple requests to access token endpoint

Hi there,

I am using the auth0-spa-js library (1.8.1) along with Rotating Refresh Tokens and localstorage. The application is initialising the client using the constructor method. When we make requests to one of our endpoints we first call getTokenSilently. If this is successful we use the access token in the header of the network request to our domain. If an access token has been obtained previously then the value is returned from the cache. This seems to work correctly most of the time. However, if some time has passed since the access token was obtained it seems that a new request is made, as you might expect. Unfortunately, it seems that if we have a series of requests to our domain, which are proceeded with calls to getTokenSilently, each request will trigger a call to the access token endpoint. This was something that I was expect the library to account for. Can you tell me what the expected behaviour should be? I can see that there is some code for obtaining a lock between browser tabs but I’m not sure whether this or something similar is supposed to be effective for multiple sequential requests in the same tab. Can you please advise?

Thanks,
Jon