mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
fix: Properly iterate over credentials with expressions (#8502)
This commit is contained in:
parent
39e8754784
commit
0e9a5a2ab2
|
@ -1714,6 +1714,7 @@ export async function requestWithAuthentication(
|
||||||
node: INode,
|
node: INode,
|
||||||
additionalData: IWorkflowExecuteAdditionalData,
|
additionalData: IWorkflowExecuteAdditionalData,
|
||||||
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
||||||
|
itemIndex?: number,
|
||||||
) {
|
) {
|
||||||
let credentialsDecrypted: ICredentialDataDecryptedObject | undefined;
|
let credentialsDecrypted: ICredentialDataDecryptedObject | undefined;
|
||||||
|
|
||||||
|
@ -1738,7 +1739,7 @@ export async function requestWithAuthentication(
|
||||||
if (additionalCredentialOptions?.credentialsDecrypted) {
|
if (additionalCredentialOptions?.credentialsDecrypted) {
|
||||||
credentialsDecrypted = additionalCredentialOptions.credentialsDecrypted.data;
|
credentialsDecrypted = additionalCredentialOptions.credentialsDecrypted.data;
|
||||||
} else {
|
} else {
|
||||||
credentialsDecrypted = await this.getCredentials(credentialsType);
|
credentialsDecrypted = await this.getCredentials(credentialsType, itemIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (credentialsDecrypted === undefined) {
|
if (credentialsDecrypted === undefined) {
|
||||||
|
@ -3000,6 +3001,7 @@ const getRequestHelperFunctions = (
|
||||||
credentialsType,
|
credentialsType,
|
||||||
requestOptions,
|
requestOptions,
|
||||||
additionalCredentialOptions,
|
additionalCredentialOptions,
|
||||||
|
itemIndex,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return await requestWithAuthentication.call(
|
return await requestWithAuthentication.call(
|
||||||
this,
|
this,
|
||||||
|
@ -3009,6 +3011,7 @@ const getRequestHelperFunctions = (
|
||||||
node,
|
node,
|
||||||
additionalData,
|
additionalData,
|
||||||
additionalCredentialOptions,
|
additionalCredentialOptions,
|
||||||
|
itemIndex,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1274,7 +1274,7 @@ export class HttpRequestV3 implements INodeType {
|
||||||
oAuth2Api = await this.getCredentials('oAuth2Api', itemIndex);
|
oAuth2Api = await this.getCredentials('oAuth2Api', itemIndex);
|
||||||
}
|
}
|
||||||
} else if (authentication === 'predefinedCredentialType') {
|
} else if (authentication === 'predefinedCredentialType') {
|
||||||
nodeCredentialType = this.getNodeParameter('nodeCredentialType', 0) as string;
|
nodeCredentialType = this.getNodeParameter('nodeCredentialType', itemIndex) as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const requestMethod = this.getNodeParameter('method', itemIndex) as string;
|
const requestMethod = this.getNodeParameter('method', itemIndex) as string;
|
||||||
|
@ -1714,6 +1714,7 @@ export class HttpRequestV3 implements INodeType {
|
||||||
nodeCredentialType,
|
nodeCredentialType,
|
||||||
requestOptions,
|
requestOptions,
|
||||||
additionalOAuth2Options && { oauth2: additionalOAuth2Options },
|
additionalOAuth2Options && { oauth2: additionalOAuth2Options },
|
||||||
|
itemIndex,
|
||||||
);
|
);
|
||||||
requestWithAuthentication.catch(() => {});
|
requestWithAuthentication.catch(() => {});
|
||||||
requestPromises.push(requestWithAuthentication);
|
requestPromises.push(requestWithAuthentication);
|
||||||
|
|
|
@ -721,6 +721,7 @@ export interface RequestHelperFunctions {
|
||||||
credentialsType: string,
|
credentialsType: string,
|
||||||
requestOptions: OptionsWithUri | RequestPromiseOptions,
|
requestOptions: OptionsWithUri | RequestPromiseOptions,
|
||||||
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
||||||
|
itemIndex?: number,
|
||||||
): Promise<any>;
|
): Promise<any>;
|
||||||
|
|
||||||
httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
|
httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
|
||||||
|
|
Loading…
Reference in a new issue