Amadeus API oauth2

Describe the problem/error/question

Trying to connect to the Amadeus API via oauth2 to get an access token.

I’ve tried several variations: importing the cURL, using the built in Credential for OAuth2 API. I’m able to get a token via postman and Terminal with no issue using:

curl "" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}"

What is the error message (if any)?

{"status":"rejected","reason":{"message":"socket hang up","name":"Error","stack":"Error: socket hang up\n    at connResetException (node:internal/errors:705:14)\n    at TLSSocket.socketOnEnd (node:_http_client:518:23)\n    at TLSSocket.emit (node:events:525:35)\n    at TLSSocket.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)","config":{"url":"","method":"post","data":"grant_type=client_credentials&scope=&client_id=*******&client_secret=*********","headers":{"Accept":"application/json, application/x-www-form-urlencoded","Content-Type":"application/x-www-form-urlencoded","User-Agent":"axios/0.21.4","Content-Length":110},"transformRequest":[null],"timeout":300000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"axios-retry":{"retryCount":0,"lastRequestTime":1686773951483}},"code":"ECONNRESET"}}

*removed credentials

Please share your workflow

Simple HTTP node thus far

Share the output returned by the last node

Information on your n8n setup

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

Hi @tonybelonie, I am sorry you’re having trouble.

I tried out the Amadeus API in n8n and it seems to work fine. One thing worth pointing out here is that n8n handles the OAuth2-requests in the background. So in your HTTP request node you’d only make the call to the actual endpoint returning the data you are looking for.

On their Getting Started page this would be step 3 (“Calling the API”). To get this to work in n8n you would:

  1. Set up OAuth2 credentials like so:

Make sure to select Client Credentials as the Grant Type. The Client ID is the API Key from the Amadeus developer portal, and the Client Secret is their API Secret.

  1. Make a request to like so:

This example would return flight offers from Paris as expected:

Hope this helps, let me know if you’re still having trouble here after following the steps above :slight_smile:


Thanks Tom!

1 Like

Follow up on this – I copied your workflow and add my creds and continued to get the same error. I’m running n8n self hosted by this guide (Hetzner | n8n Docs) I tried running the workflow locally with no issues. I’ve investigated to the best of my knowledge but can’t understand why my self hosted instance won’t work with the same workflow given I followed all the steps listed in the guide. Any advice?

Hi @tonybelonie, I am so sorry for the trouble.

I wonder if Amadeus (or potentially Cloudflare/similar services in use by Amadeus) might have blacklisted the IP of your Hetzner server.

Just to confirm, is your local setup identical to the one on your Hetzner VPS otherwise?

Yep, all default settings.

So fundamentally you’re the client in this scenario, trying to obtain data from Amadeus. socket hang up suggests the server (Amadeus) has not sent the expected answer but instead closed the connection. Seeing this works fine both on your local instance and on my own n8n instance it very much seems like this isn’t an n8n problem but a problem with your server.

Can you try connecting to your server via ssh and make the request outside of n8n from your server?

Doesn’t work –
curl: (56) OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0

I double checked and triple checked the guide and have no other settings setup in my Hetzner account, very strange.

Is there a chance you are using a firewall limiting outbound connections? Do other HTTPS connections work for you (for example curl '')?

Works: url '' {"activity":"Make bread from scratch","type":"cooking","participants":1,"price":0.2,"link":"","key":"4809815","accessibility":0.2}

So if only the Amadeus requests fail (with or without n8n), but other requests are working this would very much suggest that your Hetzner IP is on some kind of blocklist by Amadeus (or one of their service providers), possibly because it has a bad reputation from its previous owner.

This can unfortunately happen with VPS IPs (but also rotating home IPs for example).

You could consider requesting a new IP from Hetzner here, or possibly use a proxy server to route your request.

Will do, thanks for the help Tom. Appreciate it!

1 Like

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