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
const sendRequest = axios.create({
baseURL: import.meta.env.VITE_SERVER_URL,
withCredentials: true
})
const refreshAuthLogic = (failedRequest) => sendRequest.post('/admin/refresh').then(() => {
setUserInfo(prev => ({
...prev,
logged: true,
}))
return Promise.resolve()
}).catch(error => {
//se non va a buon fine butto fuori l'utente
setUserInfo({
logged: false,
info: {}
})
return Promise.reject(error);
});
// Instantiate the interceptor
createAuthRefreshInterceptor(sendRequest, refreshAuthLogic);
my tokens are all saved in cookies.
The problem is that if the original request is a POST request it works.
But if the original request is a GET the retry request after the refresh request fails with this error:
DOMException: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'function(header, parser) {
header = normalizeHeader(header);
if (!header)
return void 0;
const key = findKey(this, header);
if (key) {
const value = this[key];
if (!parser) {
return value;
}
if (parser === true) {
return parseTokens(value);
}
if (utils_default.isFunction(parser)) {
return parser.call(this, value, key);
}
if (utils_default.isRegExp(parser)) {
return parser.exec(value);
}
throw new TypeError("parser must be boolean|regexp|function");
}
}' is not a valid HTTP header field value.
I don't know if i miss something or there is a bug.
thank you.
The text was updated successfully, but these errors were encountered:
Hi @olksndrdevhub,
yes after many test i find out that this problem is due to a bug in the new version of axios > 1.0.0
The error is when axios try to set the header in retring the failed request
axios(request_options).then(() => {
...
}).catch(error => {
const originalRequest = error.config;
return axios(originalRequest) // here it messes up in setting the header correctly
});
Hi,
this is my configuration
my tokens are all saved in cookies.
The problem is that if the original request is a POST request it works.
But if the original request is a GET the retry request after the refresh request fails with this error:
I don't know if i miss something or there is a bug.
thank you.
The text was updated successfully, but these errors were encountered: