Making multiple calls to authenticateRequest with an expired access token can lead to multiple requests for a new access token with the same refresh token. As a result, the user might be left with an invalid token.
In order to prevent this, we decided to make calls to authenticateRequest sequential. This is achieved by using a serial queue and limiting its resources via a semaphore.
Description
Making multiple calls to
authenticateRequest
with an expired access token can lead to multiple requests for a new access token with the same refresh token. As a result, the user might be left with an invalid token.In order to prevent this, we decided to make calls to
authenticateRequest
sequential. This is achieved by using a serial queue and limiting its resources via a semaphore.