Automating Salesforce Data Fetching in n8n Without Manual User Login
I am trying to integrate Salesforce with n8n to automate data fetching and storage in PostgreSQL. Here’s my scenario:
I have multiple database schemas, each belonging to a specific organization.
Each schema contains an app_config table that stores app credentials (like Salesforce credentials). Some apps may have multiple accounts (e.g., multiple Salesforce credentials per organization).
I want to configure n8n such that:
It fetches the Salesforce credentials dynamically from the database (PostgreSQL).
It uses those credentials to authenticate with Salesforce and fetch leads data.
The fetched data is then inserted into the corresponding organization’s schema in PostgreSQL.
However, when configuring the Salesforce node in n8n, it prompts me to manually enter a username and password. Since this process is meant to run in the background, I want to avoid any manual input during authentication.
How can I set up n8n to authenticate with Salesforce (using something like OAuth 2.0 or JWT Bearer Flow) dynamically, without requiring username and password input, and ensure that it fetches and stores data as described?
Any guidance or examples would be greatly appreciated!
The Enterprise license has a feature for external credentials, maybe this also works for something like this. I have never tried.
I do also have a custom node created for it, but getting lots of questions from people not understanding how to use it so not advertising that anymore as I cannot be botherd providing support on that. You should be able to find it on the forums though.
I’m able to automate login for Salesforce actions nodes with OAuth2 JWT but I do not see this option in Salesforce trigger nodes (only OAuth2 is available).
Is there a way to get OAuth2 JWT option for Salesforce trigger nodes?
One workaround I found to solve this problem is to create a custom scheduled trigger & the get the credentials from the db & then query required salesforce object.