fix(HTTP Request Node): Add support for Bearer Auth in HttpRequest node (#15043)

This commit is contained in:
Shireen Missi
2025-05-02 10:33:46 +01:00
committed by GitHub
parent b5f85e7aae
commit 31003aacd1
10 changed files with 189 additions and 5 deletions

View File

@@ -640,6 +640,7 @@ export class HttpRequestV2 implements INodeType {
} catch {}
let httpBasicAuth;
let httpBearerAuth;
let httpDigestAuth;
let httpHeaderAuth;
let httpQueryAuth;
@@ -654,6 +655,10 @@ export class HttpRequestV2 implements INodeType {
try {
httpBasicAuth = await this.getCredentials('httpBasicAuth');
} catch {}
} else if (genericAuthType === 'httpBearerAuth') {
try {
httpBearerAuth = await this.getCredentials('httpBearerAuth');
} catch {}
} else if (genericAuthType === 'httpDigestAuth') {
try {
httpDigestAuth = await this.getCredentials('httpDigestAuth');
@@ -959,6 +964,11 @@ export class HttpRequestV2 implements INodeType {
};
authDataKeys.auth = ['pass'];
}
if (httpBearerAuth !== undefined) {
requestOptions.headers = requestOptions.headers ?? {};
requestOptions.headers.Authorization = `Bearer ${String(httpBearerAuth.token)}`;
authDataKeys.headers = ['Authorization'];
}
if (httpHeaderAuth !== undefined) {
requestOptions.headers![httpHeaderAuth.name as string] = httpHeaderAuth.value;
authDataKeys.headers = [httpHeaderAuth.name as string];