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

Handle HTTP requests when token is being refreshed #166

Closed
DonOmalVindula opened this issue Apr 9, 2024 · 0 comments · Fixed by #167
Closed

Handle HTTP requests when token is being refreshed #166

DonOmalVindula opened this issue Apr 9, 2024 · 0 comments · Fixed by #167
Assignees
Labels
bug Something isn't working

Comments

@DonOmalVindula
Copy link
Contributor

Describe the issue:
Currently we have implemented the httpRequest method to automatically refresh the token when a 401 status is encountered. But we do not have a method to block the HTTP requests when the token is being refreshed and this can lead to failures as the SDK will attempt to refresh the token again while it is already being refreshed.

We need an approach to block the HTTP requests until the token is refreshed and then retry the failed HTTP calls with the newly refreshed token. We have done a similar approach for SDK 0.4.xx versions. But we have missed this implementation on later versions.

How to reproduce:

  1. Wait until access token is expired.
  2. Simultaneously send multiple HTTP calls via httpRequest() method
  3. You will see that certain calls will fail along with the token refresh call as they are attempt to refresh the token multiple times simultaneously.

Expected behavior:

  1. When a 401 is encountered first, send a single refresh token call
  2. Block all the other calls while token in being refreshed
  3. Once the token has finished refreshing, attempt the blocked calls with the newly obtained token

Environment information (Please complete the following information; remove any unnecessary fields) :

  • Product Version: [e.g., IS 5.10.0, IS 5.9.0]
  • OS: [e.g., Windows, Linux, Mac]
  • Browser: [e.g., Chrome, Firefox]
  • SDK Version: [e.g., 0.1.0, 0.1.1]
@DonOmalVindula DonOmalVindula added the bug Something isn't working label Apr 9, 2024
@DonOmalVindula DonOmalVindula self-assigned this Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant