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

@@ -100,6 +100,7 @@ export class HttpRequestV3 implements INodeType {
} catch {}
let httpBasicAuth;
let httpBearerAuth;
let httpDigestAuth;
let httpHeaderAuth;
let httpQueryAuth;
@@ -156,6 +157,8 @@ export class HttpRequestV3 implements INodeType {
if (genericCredentialType === 'httpBasicAuth') {
httpBasicAuth = await this.getCredentials('httpBasicAuth', itemIndex);
} else if (genericCredentialType === 'httpBearerAuth') {
httpBearerAuth = await this.getCredentials('httpBearerAuth', itemIndex);
} else if (genericCredentialType === 'httpDigestAuth') {
httpDigestAuth = await this.getCredentials('httpDigestAuth', itemIndex);
} else if (genericCredentialType === 'httpHeaderAuth') {
@@ -496,6 +499,11 @@ export class HttpRequestV3 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];