refresh token logic got loop back to createRequestQueueInterceptor
See original GitHub issueProblem: refresh token axios got loop back to createRequestQueueInterceptor, refreshing becomes stale
Hi~ thanks for the lib. Summary: I have the same default axios running for normal request and refresh token, when it wants to run the refresh token, the request got queue to requestQueue, so it ended up stale. and the refreshing is never resolve.
Here are the usage:
// Instantiate the interceptor (you can chain it as it returns the axios instance)
createAuthRefreshInterceptor(axios, refreshAuthLogic);
const refreshAuthLogic = (failedRequest: any) => {
const asyncToPromise = async () => {
// ...preprocessing
const resp = await axios.post('/refreshUrl')
const {accessToken} = resp.data
// ...postprocessing
return Promise.resolve(accessToken)
}
return asyncToPromise().then(async accessToken => {
failedRequest.response.config.headers['Authorization'] = 'Bearer ' + accessToken;
return Promise.resolve();
})
};
Current workaround: create another axios instance just for refreshing, so it wont get intercept
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (10 by maintainers)
Top Results From Across the Web
feat(authentication): refreshing/replacing the token · Issue #4573
The simplest approach: very long-lived access token with no refresh mechanism. This means creating access tokens with TTL set to weeks or months ......
Read more >JWT Authentication Extension | LoopBack Documentation
@loopback/authentication-jwt · To generate refresh token : to generate the refresh token and access token when user logins to your app with provided...
Read more >Refresh AccessToken in Loopback 3 - node.js - Stack Overflow
Just update created field in accessToken table against a particular user. Go to server.js file and update the following code :
Read more >Cisco Secure Firewall ASA Series Syslog Messages - Cisco
Flow is a loopback. Free the flow created as result of packet injection. The connection was built because the packet tracer feature sent...
Read more >Component Reference - Apache JMeter - User's Manual
Several test elements use JMeter properties to control their behaviour. These properties are normally resolved when the class is loaded.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Isn’t the skipAuthRefresh flag supposed to be passed in the request config? When using axios.post, that would be the third argument (and not the second) if I’m not mistaken.
Merged in #163 with a fix in #166. Thanks for the contributions.