OAuth1.0a credential setup issue with "Unable to get access tokens!"

Hi, first of all, n8n it’s A-MA-ZING!

I’m running into an issue while trying to setup an OAuth1 credential to connect to Garmin API.

After I set all the OAuth1 parameters and click on Connect my Account, I get redirected to Garmin site for login, and after I give all permissions, the callback is called and I get the response:

code: 0
message: "Unable to get access tokens!"
hint: ""

Some details about my setup:

  • All the OAuth1 parameters are correct, I tested with another OAuth library in python and was able to connect.
  • I’m using n8n 0.152.0
  • My config (based on the Server install docs with docker-compose running in a VPS):

(I’m skipping traefik config for brevity)

 n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - N8N_DIAGNOSTICS_ENABLED
      - N8N_USE_DEPRECATED_REQUEST_LIB
      - EXECUTIONS_DATA_PRUNE
      - EXECUTIONS_DATA_MAX_AGE
      - WORKFLOWS_DEFAULT_NAME
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - TZ=${GENERIC_TIMEZONE}
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
      - /home/deploy/app/n8n/local-files:/files
  • As you can see I tried to set N8N_USE_DEPRECATED_REQUEST_LIB=true as recommended in another post. But still it didn’t work.

Anything I can do to make it work?

Thank you

Great to know that you are enjoying n8n. n8n supports OAuth1.0a, which is different than OAuth1.0. So I wonder if that is why it’s not working. Is that the only authentication method that they use? Can you share the API docs so I can have a look?

Hi @RicardoE105

Sorry, was not clear enough. I can confirm they implement OAuth 1.0a because their specification states that. The document is behind a login to their development program, but I’m sharing a dropbox link to the file: Dropbox - Garmin_Connect_OAuth_Specification.pdf - Simplify your life

According to this, n8n should be able to authenticate. I have to test it to try to replicate the issue. Are there any restrictions to getting the OAuth1.0a credentials? for example, a paid Garmin account?

You need to have a Garmin Connect account and also apply to developer program, which should be possible assuming you would be representing n8n.

Link to Garmin Connect account creation: Garmin | Account | Create
Link to developer programme: Overview | Garmin Connect Developer Program | Garmin Developers

If there’s anything I can check on my side, such as evidences from log, I can do it, just let me know where to look.

Workaround for me at the moment is a script that does the request and I execute it from CLI node. I’m even signing the script with npm’s oauth-1.0a package, the same one being used by n8n internally.

Thank you

I tested the same setup in a n8n.cloud account and I got “Something went wrong” error. Again, I’m sure the credentials are correct because I tested them with a script.

When I have time will try to replicate the issue.

No worries, thank you for your support, @RicardoE105!