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