-
Notifications
You must be signed in to change notification settings - Fork 52
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
Handling refresh token by recall same request after refreshing the token #39
Comments
You are on the right track; I built something similar two years ago. You just have to store the failed request somewhere and simply redispatch it; for this you must correlate the errors with the actual requests made; in the original Angular interceptor stuff, you could get the config of the original request and thus re-construct the actual request. |
How about instead of retrying when there is 401 HTTP status, simply check earlier (in |
Did find the solution? because I have the same issue |
I am having the same issue. Not sure how to recall the failed request after refreshing token. Is there any solution for this? |
How if, we intercept in the request, store the url in the storage, and then use the stored url after the refresh token used to get access token ? |
Here is example of refresh token and recall the original request
|
This will not work if multiple requests were made in parallel. It will use the wrong url and config |
Hi,
I am trying to make a common interceptor to authorize all my outgoing requests.
My logic is as follows:
All my outgoing requests/API calls passes through the interceptor first to check on my token expiry and in-case the response was un-authorized I make an internal call to refresh the token and update my storage keys with the new values.
Now I need to recall the original request with the new token value, but I can't figure out how to detect the original request that passed through the interceptor.
This is my code :
The problem is that I've no idea how to recall the same request that passed through the interceptor.. I did some search on this, but couldn't find a way to execute this.
The text was updated successfully, but these errors were encountered: