Generic OAuth2 - 400 Error

Hello there,

I am trying to setup a generic OAuth Integration - it is working until the last step. I authenticate the service and get the callback but it returns an error (see below):

Callback URL (taken from the interface):
http://mysub.mydomain.com:portnumber/rest/oauth2-credential/callback

It is calling this url
http://mysub.mydomain.com:portnumber/rest/oauth2-credential/callback?code=sNC8YguzSoePokG2oCW801N1UihjKVOiZKBZzm82rikzMvhF&state=eyJ0b2tlbiI6IjRwYmczMmtDLTgxTzBRVURKRHMzVGowYWVlMkduNkZvaV9MYyIsImNpZCI6IjYifQ==

Error Message:
{"code":0,"message":"HTTP status 400","hint":"","stack":"Error: HTTP status 400\n at /app/node_modules/client-oauth2/src/client-oauth2.js:283:25\n at processTicksAndRejections (internal/process/task_queues.js:95:5)\n at async /app/node_modules/n8n/dist/src/Server.js:1000:36"}

I tried to dig around a little - I tested the github oauth - this is working. If I call the callback endpoint it is asking for more parameters (which indicates it is working).

I am running on 0.133.0 inside docker on an ARM build.

Would be great if someone can share more insights into this and help me out.

Hey @Manuel,

How are you doing?

Are you creating your own node? If yes, can you point out the service you’re adding OAuth for? Different services expect different parameters, and also return the data in different formats. You may want to check their docs for that.

Hey,

thanks for answering.
I am trying to auth against Bondora - their API is described here: Intro

Their example states:

curl -X GET "https://www.bondora.com/oauth/authorize
    ?response_type=code
    &client_id=8084a9d9e2c34f78ad6d502096cbd80b
    &state=xyz
    &scope=BidsEdit%20BidsRead%20Investments%20SmBuy%20SmSell
    &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb"
Response Redirect Url:
    https://client.example.com/cb?code=wE7zyDNb2qDnWsjszg3QNqsbFtj0f75Lg2iCTHBInWGbqFca&state=xyz

If I compare the Response Redirect URL - it looks good. I assumed that the error I am seeing is an internal N8N error - given that I am doing something wrong.

Hey,

Thank you for sharing the details. Can you update n8n to the latest version? We have changed the request library. This is not the solution to your problem, but hopefully, it should return a better error message and make your node compatible with the newer versions.

Do you have the code available on GitHub? If not, can you share the code you’re using here?