fix: Prevent Authorization header on external URLs (#9061)

🐛 (api.tsx): fix issue where Authorization header was not being set correctly for internal requests
💡 (api.tsx): improve logic to set Authorization header only for internal requests and add custom headers for all requests
This commit is contained in:
Cristhian Zanforlin Lousa 2025-07-15 20:09:48 -03:00 committed by GitHub
commit 9b3356e1c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,11 +49,11 @@ function ApiInterceptor() {
request: (url, config) => {
const accessToken = customGetAccessToken();
if (accessToken && !isAuthorizedURL(config?.url)) {
config.headers["Authorization"] = `Bearer ${accessToken}`;
}
if (!isExternalURL(url)) {
if (accessToken && !isAuthorizedURL(config?.url)) {
config.headers["Authorization"] = `Bearer ${accessToken}`;
}
for (const [key, value] of Object.entries(customHeaders)) {
config.headers[key] = value;
}