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 refresh token and failed requests retry when access token expires #1899
Comments
It would be cool to have an example in the docs for this. |
+1 |
@hadiranjbar25 Could you please leave the issue open, even if you solved your problem? I think this is still a neat addition to the docs. |
@janhesters I got that we should handle it in axios level, not in redux-saga. |
i tried with interceptor in axios, but when the API responses 401 and interceptor capture and handle that response, the yield in saga is launched and then entry in the catch exception, before of the interceptor complete the flow and renew token. do you solved it? |
Yes, that's because you are resolving it even if it is unauthorized. While you have not resolved it, saga waits for the response. This is a great tutorial I have used to implement it: |
How to handle multiple requests after refresh? My interceptor makes the calls but my state is not updated because saga is resolving promise as error due to token expiry. How do i control my saga response for refresh?
|
I am trying to implement an OAuth authentication mechanism with refresh token and access token. I have searched for the solution a lot. But, still I haven't find any comprehensive solution that works for me.
I have different watchers for different actions. The main problem is when the access token expires. I want to have a solution for refreshing the token and more importantly re-try failed request with 401 code. What is the best solution for my case? I don't want to miss any failed request and want to retry them all.
The text was updated successfully, but these errors were encountered: