You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've configured two instances of Axios, each config with its createAuthRefreshInterceptor to manage token refresh. these Axios instances interact with distinct servers, yet both servers employ the same authentication mechanism. However, I've encountered a scenario where both Axios instances are invoked simultaneously within a single useEffect hook. This results in concurrent token refresh requests using the same refresh token. While the first API call successfully refreshes the token, the second one fails and else logic executed
I want the token refresh process to be initiated only once in response to a 401 error across multiple instance APIs. Subsequent failed API calls should wait for the token refresh to complete before retrying, instead of triggering additional refresh requests
is there any way to achieve this?
The text was updated successfully, but these errors were encountered:
vijay-talviya
changed the title
Multiple Time refreshAuthLogic is running when multiple axios instance
Multiple Axios Instances Triggering Duplicate refreshAuthLogic Calls
Jun 14, 2024
I've configured two instances of Axios, each config with its createAuthRefreshInterceptor to manage token refresh. these Axios instances interact with distinct servers, yet both servers employ the same authentication mechanism. However, I've encountered a scenario where both Axios instances are invoked simultaneously within a single useEffect hook. This results in concurrent token refresh requests using the same refresh token. While the first API call successfully refreshes the token, the second one fails and else logic executed
I want the token refresh process to be initiated only once in response to a 401 error across multiple instance APIs. Subsequent failed API calls should wait for the token refresh to complete before retrying, instead of triggering additional refresh requests
is there any way to achieve this?
The text was updated successfully, but these errors were encountered: