Cannot get credentials to Salesforce setup properly.
- Cannot authenticate an API Only user with OAuth
- Cannot authenticate any user on a sandbox with OAuth
- Cannot configure JWT on self hosted or cloud in a sandbox or production.
We have a limited number of licenses so I'd like to setup either JWT or an API only user, and I'd also like to connect to a sandbox so I'm not developing in prod.
For JWT I've followed the steps in the n8n documents and similar steps from other web sources, essentially:
- create key and cert
- connected app or external client app in Salesforce with cert uploaded
- consumer key from app to n8n credentials
- full text of key file to n8n credentials (tried with and without trailing return)
- username from Salesforce as an API only user and also as an Admin
Every single time regardless of hosting type or environment the same error occurs when testing the credential:
"secretOrPrivateKey must be an asymmetric key when using RS256"
I have setup keys/certs using the methods from the link in the n8n docs, methods from other forums and posts, methods from ChatGPT and Gemini.
I have verified that the format of the key is correct and have tried copying it from editors such as Atom, VSCode, and from TextEdit, and also directly from Terminal with pbcopy < server.key
After far too many attempts I tried moving to OAuth.
- In a Sandbox it always tells me my credentials are bad which I suspect is due to the login.salesforce popup rather than the test.salesforce I would generally use, but attempts to include the sandbox in the login also fail.
- In prod it does allow me to connect with a fully licensed admin user, but fails when I try to connect with an API only user. This is for a nonprofit on a plan with 10 licenses, and those are needed for actual people.
What is the error message (if any)?
If OAuth: "An unexpected error has occured during authentication"
If JWT: "secretOrPrivateKey must be an asymmetric key when using RS256"
additional from stack trace: n8n-core/src/execution-engine/workflow-execute.ts:1676:27 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2292:11
Running n8n via (Docker, npm, n8n cloud, desktop app): Docker then Cloud
Operating system: Mac OS - Monterey
Just started the trial and have made no modifications. This is the only thing I’ve done since it’s the one thing that will stop us from using n8n unless I can solve this
ok… stupid user error: I am new to n8n and haven’t used expressions yet, so when the documentation said to use the multiline editor I didn’t connect that it meant the expression editor. I kept pasting the key value into the fixed rather than the expression. That was the entire problem from day one.