From eda249642c574d2f6b4ed4c20a98de969b12831e Mon Sep 17 00:00:00 2001 From: Rohit Gahlawat <283466839+Rohit-Gahlawat@users.noreply.github.com> Date: Fri, 7 Aug 2026 18:17:06 +0530 Subject: [PATCH] feat(Salesforce Trigger Node): Add OAuth2 JWT authentication support (#32257) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Dimitri Lavrenük <20122620+dlavrenuek@users.noreply.github.com> --- .../Salesforce/SalesforceTrigger.node.ts | 31 +++++++++++++++++++ .../__test__/SalesforceTrigger.node.test.ts | 24 ++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/packages/nodes-base/nodes/Salesforce/SalesforceTrigger.node.ts b/packages/nodes-base/nodes/Salesforce/SalesforceTrigger.node.ts index efe1d5050f3..35bde43e155 100644 --- a/packages/nodes-base/nodes/Salesforce/SalesforceTrigger.node.ts +++ b/packages/nodes-base/nodes/Salesforce/SalesforceTrigger.node.ts @@ -37,12 +37,43 @@ export class SalesforceTrigger implements INodeType { { name: 'salesforceOAuth2Api', required: true, + displayOptions: { + show: { + authentication: ['oAuth2'], + }, + }, + }, + { + name: 'salesforceJwtApi', + required: true, + displayOptions: { + show: { + authentication: ['jwt'], + }, + }, }, ], polling: true, inputs: [], outputs: [NodeConnectionTypes.Main], properties: [ + { + displayName: 'Authentication', + name: 'authentication', + type: 'options', + options: [ + { + name: 'OAuth2', + value: 'oAuth2', + }, + { + name: 'OAuth2 JWT', + value: 'jwt', + }, + ], + default: 'oAuth2', + description: 'OAuth Authorization Flow', + }, { displayName: 'Trigger On', name: 'triggerOn', diff --git a/packages/nodes-base/nodes/Salesforce/__test__/SalesforceTrigger.node.test.ts b/packages/nodes-base/nodes/Salesforce/__test__/SalesforceTrigger.node.test.ts index 6aa330cb463..46bbea53085 100644 --- a/packages/nodes-base/nodes/Salesforce/__test__/SalesforceTrigger.node.test.ts +++ b/packages/nodes-base/nodes/Salesforce/__test__/SalesforceTrigger.node.test.ts @@ -128,6 +128,30 @@ describe('SalesforceTrigger', () => { }); }); + describe('Authentication', () => { + it('should offer both OAuth2 and JWT credentials', () => { + const credentials = trigger.description.credentials ?? []; + + const oAuth2 = credentials.find((c) => c.name === 'salesforceOAuth2Api'); + const jwt = credentials.find((c) => c.name === 'salesforceJwtApi'); + + expect(oAuth2?.displayOptions?.show?.authentication).toEqual(['oAuth2']); + expect(jwt?.displayOptions?.show?.authentication).toEqual(['jwt']); + }); + + it('should expose an authentication selector defaulting to OAuth2', () => { + const authentication = trigger.description.properties.find( + (p) => p.name === 'authentication', + ); + + expect(authentication?.default).toBe('oAuth2'); + expect(authentication?.options).toEqual([ + { name: 'OAuth2', value: 'oAuth2' }, + { name: 'OAuth2 JWT', value: 'jwt' }, + ]); + }); + }); + describe('Poll Function - Parameter Setup', () => { beforeEach(() => { mockPollFunctions.getNodeParameter.mockImplementation((paramName: string) => {