Connection to Salesforce OAuth2 API failed after N8N upgrade

Describe the problem/error/question

Hello, After upgrading to N8N version 1.24.1, we are currently encountering an “Unauthorized” error when trying to establish a connection to Salesforce CRM using Salesforce OAuth2 API credentials. Notably, these credentials worked seamlessly in our previous N8N version. Are there any changes in the authentication process?

What is the error message (if any)?

Unauthorized

Please share your workflow

NA

Information on your n8n setup

  • n8n version: 1.24.1
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux

Any advice on how to resolve this?

Screen Shot 2024-01-30 at 3.46.59 PM

Hey @Lakshmi,

What version of n8n were you using before the upgrade?

Hi Jon, we were on n8n version: 0.221.2

Hey @Lakshmi,

Ah that is a real old so going back to that version isn’t going to be an option because of the database changes.

Nothing should have changed in the node but it could be that another recent has broken it, I will do some testing in the morning and see if I can work out what is going on.

Is the app you are connecting to in Salesforce new or old and does it have PKCE enabled?

1 Like

Sure, thank you Jon!

No, PKCE is disabled. We attempted connections with both the new and old Salesforce apps, but unfortunately, no success.

Hey @Lakshmi,

I will dig into this shortly and see if I can work out what is going on.

1 Like

I’d like to add that we are currently testing the connection using localhost.

Hello Jon,

Could you please provide an update or offer any recommendations on how we can resolve this?

Thanks!

Hey @Lakshmi,

I am still looking into this one, I am having issues with getting oauth working at all in my local environment but once that is resolved I should be able to get this sorted fairly quickly.

1 Like

Hi Jon!

Could you please provide an update on the progress regarding the issue? Were you able to reproduce it? The inability to connect to Salesforce CRM is a significant concern as it’s currently preventing us from proceeding with the upgrade of n8n in our Production environment. Any insights or updates you can provide would be greatly appreciated.

Hey @Lakshmi,

I have managed to reproduce it but I have not yet found a cause. For now the older version remains the best option until I can work this one out, I also plan on adding support for PKCE soon as well.

I will see if I can get to this on Monday.

1 Like

Hello Jon!

Do you have any updates on the issue? Were you able to make any progress in identifying the root cause?

Hey @Lakshmi,

Oddly enough while I was digging into it the connection just started working without me changing anything, This is on 1.28.0 I am not sure why it has started working again though as there has been no changes.

Are you able to try and connect again to see if that helps?

1 Like

Hello Jon,

I’ve locally upgraded my N8N from version 1.24.1 to version 1.28.0, but I’m still encountering the “Unauthorized” error.

Hey @Lakshmi,

That is odd, I have done a few things now and I am not able to get it to fail.

Have you tried making a new app in Salesforce to see if that helps?

Hey @Jon and @Lakshmi,
Just wanted to know if there has been any update on this issue, we have been facing the same issue post upgrade.

Hey @Yash_Khatri,

None at the moment as it is still working for me, One thing to check is what format is your url and have you configured the allow list for IPs for your salesforce connection?

Do you also know which version you upgraded from and what version you are on now? I am currently on 1.29.1 and things are still working.

Hey @Jon,
Its not working in the cases where we are trying to connect it via the unofficial api. Making the call on /rest/oauth2-credential endpoint to get the authorization url for salesforce. Passing the similar pattern of params to the endpoint but the issue still persists.
Currently I am on version 1.25.0.

Hey @Yash_Khatri,

When you say the “unofficial API” what do you mean?

@Lakshmi @Yash_Khatri could you DM me your full OAuth Callback URLs?