feat: support custom authorization headers, fix #395
This commit is contained in:
parent
c6fad3f923
commit
618f24a9ac
1 changed files with 24 additions and 1 deletions
|
|
@ -297,7 +297,12 @@ export function useConnection({
|
|||
bearerToken || (await serverAuthProvider.tokens())?.access_token;
|
||||
if (token) {
|
||||
const authHeaderName = headerName || "Authorization";
|
||||
headers[authHeaderName] = `Bearer ${token}`;
|
||||
headers[authHeaderName] = token;
|
||||
|
||||
// Add custom header name as a special request header to let the server know which header to pass through
|
||||
if (headerName && headerName.toLowerCase() !== "authorization") {
|
||||
headers["x-custom-auth-header"] = headerName;
|
||||
}
|
||||
}
|
||||
|
||||
// Create appropriate transport
|
||||
|
|
|
|||
Loading…
Reference in a new issue