mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(HTTP Request Node): Add support for Bearer Auth in HttpRequest node (#15043)
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user