OAuth2 Something went wrong. Please try again!

I’m trying to authenticate using an OAuth2 credential against a third party API (Relyon one fieldservice). I’ve successfully authenticated with this API using Postman where I use the callback https://oauth.pstmn.io/v1/callback so I’m assuming all details I’ve entered, like the Authorization URL, Client ID, Client Secret and so on are correct.

When I’m trying to authenticate with the OAuht2 credential in n8n, I’ve changed the callback at the Relyon side to: https://oauth.n8n.cloud/oauth2/callback. When I click the button ‘Connect my account’ inside the credential in n8n, a popup shows where I have to enter my Relyon credentials. So far so good. But then I get this error message: Something went wrong. Please try again!

I think this is at the n8n side because this is inside the popup with url https://oauth.n8n.cloud/oauth2/callback?code=xxxxxxx
I don’t see any other error messages, except for this one so I have no clue where to look.

Does anybody know what to do?

(I’m using n8n cloud version 1.20.0)

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hi, can you please DM me your cloud account name?
It might find the issue in instance logs.

Hi @netroy, I’m not allowed to send DM’s yet. Can you please DM me first so I can reply?

Thanks.
I’m not seeing any unhandled errors on your instance’s logs, or on our error tracker so far.
I’ve restarted your instance with some debug logging enabled.
Can you please try to authenticate again :pray: ?

I’ve just tried a few times to authenticate (with same result obviously). Hopefully the logs will tell us something.

I see nothing in the logs or on our error tracker, which makes wonder if this is a browser issue.

Can you please try using a completely different browser, to make sure that this is not being caused by a browser plugin messing with cookies or redirects ?

Hi @netroy I’ve tried with Chrome, Firefox and Edge. All in incognito mode and with all extensions switched off. All with the same result, which is “Something went wrong”.

I also tried to authenticate with Strava (did that with Firefox), with the bare Oauth2 credential, not with the built in Strava credential and all went good. So that makes me think that the problem lies at Relyon.

Today I noticed that Relyon returnes an ‘expires’ field in the token response instead of an ‘expires_in’ field, which I think is not according to the spec. If n8n expects an ‘expires_in’, maybe this can cause the error message?

I’ve just spinned up a Droplet at DigitalOcean with n8n and now I’m getting a bit more info. When I try to connect, I’m getting the message: Error: Insufficient parameters for OAuth2 callback.

I’ve also set the WEBHOOK_URL as suggested somewhere else, but with the same result.

What is missing here?

When n8n starts the oauth process, it generates a CSRF state, sends it to the oauth server, and then expects the same state to be present on the callback url.
This looks like the oauth server is not returning the state that was passed to it.

1 Like

The Oauth server is indeed not responding with the state parameter, so I guess this is the problem then. Thanks for your help @netroy !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.