Issue with token refresh
kumawatanupriya opened this issue · comments
Hi, I am using react-adal library to connect to ADFS. I am using axios interceptor to aquire token which will refresh the token silently as written in docs, But it not doing for me. What could be the issue.
Please find the below code:
axiosApi.interceptors.request.use((config) => {
return new Promise((resolve, reject) => {
adalInstance.acquireToken(adalConfig.endpoints.api, (message, token, error) => {
let azureToken = adalInstance.getCachedToken(adalConfig.resource);
if (azureToken) {
config.headers.Authorization = "Bearer " + azureToken;
resolve(config);
}else {
console.log("in interceptor reject", config, adalInstance.getCachedUser());
reject(config);
}
});
})
},
any help is appreciated, and somehow it's delaying the api response as well after adding the aquire token.