fix: update default authorization header to include empty Bearer token and improve validation logic
This commit is contained in:
parent
de71fb9d1c
commit
34534ed062
1 changed files with 17 additions and 7 deletions
|
|
@ -402,7 +402,7 @@ export function useConnection({
|
|||
|
||||
const isEmptyAuthHeader = (header: CustomHeaders[number]) =>
|
||||
header.name.trim().toLowerCase() === "authorization" &&
|
||||
header.value.trim() === "Bearer";
|
||||
header.value.trim().toLowerCase() === "bearer";
|
||||
|
||||
// Check for empty Authorization headers and show validation error
|
||||
const hasEmptyAuthHeader = finalHeaders.some(
|
||||
|
|
@ -418,7 +418,11 @@ export function useConnection({
|
|||
});
|
||||
}
|
||||
|
||||
const needsOAuthToken = finalHeaders.length === 0 || hasEmptyAuthHeader;
|
||||
const needsOAuthToken = !finalHeaders.some(
|
||||
(header) =>
|
||||
header.enabled &&
|
||||
header.name.trim().toLowerCase() === "authorization",
|
||||
);
|
||||
|
||||
if (needsOAuthToken) {
|
||||
const oauthToken = (await serverAuthProvider.tokens())?.access_token;
|
||||
|
|
|
|||
Loading…
Reference in a new issue