From 48b240b0269858adb8fde8abb8a7211b2a3e78e0 Mon Sep 17 00:00:00 2001 From: Elias Meire Date: Wed, 15 Nov 2023 09:13:33 +0100 Subject: [PATCH] fix(HTTP Request Node): Support generic credentials when using pagination (#7686) Github issue / Community forum post (link here to close automatically): fixes #7653 Co-authored-by: Michael Kret --- packages/core/src/NodeExecuteFunctions.ts | 4 ++-- .../HttpRequest/V3/HttpRequestV3.node.ts | 21 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index eaab998397..c1ae3ea95b 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -1695,10 +1695,10 @@ export async function requestWithAuthentication( try { const parentTypes = additionalData.credentialsHelper.getParentTypes(credentialsType); - if (parentTypes.includes('oAuth1Api')) { + if (credentialsType === 'oAuth1Api' || parentTypes.includes('oAuth1Api')) { return await requestOAuth1.call(this, credentialsType, requestOptions, false); } - if (parentTypes.includes('oAuth2Api')) { + if (credentialsType === 'oAuth2Api' || parentTypes.includes('oAuth2Api')) { return await requestOAuth2.call( this, credentialsType, diff --git a/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts b/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts index 854bd8807e..9c44ab92b0 100644 --- a/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts +++ b/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts @@ -1203,36 +1203,37 @@ export class HttpRequestV3 implements INodeType { let httpCustomAuth; let oAuth1Api; let oAuth2Api; - let nodeCredentialType; + let nodeCredentialType: string | undefined; + let genericCredentialType: string | undefined; if (authentication === 'genericCredentialType') { - const genericAuthType = this.getNodeParameter('genericAuthType', 0) as string; + genericCredentialType = this.getNodeParameter('genericAuthType', 0) as string; - if (genericAuthType === 'httpBasicAuth') { + if (genericCredentialType === 'httpBasicAuth') { try { httpBasicAuth = await this.getCredentials('httpBasicAuth'); } catch {} - } else if (genericAuthType === 'httpDigestAuth') { + } else if (genericCredentialType === 'httpDigestAuth') { try { httpDigestAuth = await this.getCredentials('httpDigestAuth'); } catch {} - } else if (genericAuthType === 'httpHeaderAuth') { + } else if (genericCredentialType === 'httpHeaderAuth') { try { httpHeaderAuth = await this.getCredentials('httpHeaderAuth'); } catch {} - } else if (genericAuthType === 'httpQueryAuth') { + } else if (genericCredentialType === 'httpQueryAuth') { try { httpQueryAuth = await this.getCredentials('httpQueryAuth'); } catch {} - } else if (genericAuthType === 'httpCustomAuth') { + } else if (genericCredentialType === 'httpCustomAuth') { try { httpCustomAuth = await this.getCredentials('httpCustomAuth'); } catch {} - } else if (genericAuthType === 'oAuth1Api') { + } else if (genericCredentialType === 'oAuth1Api') { try { oAuth1Api = await this.getCredentials('oAuth1Api'); } catch {} - } else if (genericAuthType === 'oAuth2Api') { + } else if (genericCredentialType === 'oAuth2Api') { try { oAuth2Api = await this.getCredentials('oAuth2Api'); } catch {} @@ -1682,7 +1683,7 @@ export class HttpRequestV3 implements INodeType { requestOptions, itemIndex, paginationData, - nodeCredentialType, + nodeCredentialType ?? genericCredentialType, ); requestPromises.push(requestPromise); } else if (authentication === 'genericCredentialType' || authentication === 'none') {