# OAuth2 Something went wrong. Please try again!

**URL:** <https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391>\
**Category:** Questions\
**Tags:** oauth2\
**Created:** [December 20, 2023, 8:15am UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391 "2023-12-20T08:15:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterkuli](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@peterkuli](https://community.n8n.io/u/peterkuli)\
**Post date:** [December 20, 2023, 8:15am UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/1 "2023-12-20T08:15:28Z")

</div>

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](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](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](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)

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/196425_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [December 20, 2023, 8:15am UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/2 "2023-12-20T08:15:29Z")

</div>

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:**

---

<div class="post-metadata">

**Author:** ![netroy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/netroy/32/22154_2.png) [@netroy](https://community.n8n.io/u/netroy)\
**Post date:** [December 20, 2023, 8:26am UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/3 "2023-12-20T08:26:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![peterkuli](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@peterkuli](https://community.n8n.io/u/peterkuli)\
**Post date:** [December 20, 2023, 9:04am UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/4 "2023-12-20T09:04:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![netroy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/netroy/32/22154_2.png) [@netroy](https://community.n8n.io/u/netroy)\
**Post date:** [December 20, 2023, 4:48pm UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/5 "2023-12-20T16:48:59Z")

</div>

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 🙏 ?

---

<div class="post-metadata">

**Author:** ![peterkuli](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@peterkuli](https://community.n8n.io/u/peterkuli)\
**Post date:** [December 20, 2023, 5:38pm UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/6 "2023-12-20T17:38:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![netroy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/netroy/32/22154_2.png) [@netroy](https://community.n8n.io/u/netroy)\
**Post date:** [December 21, 2023, 4:15pm UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/7 "2023-12-21T16:15:41Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![peterkuli](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@peterkuli](https://community.n8n.io/u/peterkuli)\
**Post date:** [December 21, 2023, 7:41pm UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/8 "2023-12-21T19:41:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![peterkuli](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@peterkuli](https://community.n8n.io/u/peterkuli)\
**Post date:** [January 2, 2024, 3:40pm UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/9 "2024-01-02T15:40:42Z")

</div>

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.

 ![Screenshot_1](https://europe1.discourse-cdn.com/n8n/original/3X/2/8/28dd9a465398449b4109836405a2d14fadc37556.jpeg)

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

What is missing here?

---

<div class="post-metadata">

**Author:** ![netroy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/netroy/32/22154_2.png) [@netroy](https://community.n8n.io/u/netroy)\
**Post date:** [January 2, 2024, 5:45pm UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/10 "2024-01-02T17:45:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![peterkuli](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@peterkuli](https://community.n8n.io/u/peterkuli)\
**Post date:** [January 3, 2024, 9:59am UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/11 "2024-01-03T09:59:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [January 10, 2024, 9:59am UTC](https://community.n8n.io/t/oauth2-something-went-wrong-please-try-again/34391/12 "2024-01-10T09:59:55Z")

</div>

Closed on January 10, 2024, 9:59am UTC

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