Issue with OAuth2 credential and Strava

Hi,

I’m trying to setup an OAuth2 credential with Strava API. When trying to connect, the redirection to Strava works, but the callback fails with the error message:

code: 0
message: "HTTP status 400"
hint: ""

Some details about my setup:

  • 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
      - 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

The Strava API parameters are correct, here’s a screenshot of my setup:

Also the callback is properly set in Strava API settings (only the domain).

I also tested this setup on n8n.cloud and got “Something went wrong”

Anything I can do to make it work?

Thanks for your help

:man_facepalming: I just saw that there’s a Strava node and everything worked well after setting up the Strava credential type.

I’m not sure the issue presented here applies to all Oauth2 flows though, might be worth checking.

Ok, this post still applies because the Strava node doesn’t expose the Streams endpoints. I tried then to use a HTTP Request with the Strava credential and OAuth2 selected, but n8n doesn’t allow me to select that credential.

Change the authentication to “Body” and try it again.

1 Like

Thank you, @RicardoE105. Changing auth to body solved the issue.

1 Like

I have a question @RicardoE105, does an OAuth2 type of credential refresh tokens automatically? Because I’m having to refresh it manually for this case. But when using Strava node, I don’t need to.

Thanks

Yes, it does it automatically. However, with the Strava node, we use a parameter that is not exposed in the HTTP node. Out of the nodes we have, only four use and need the parameter includeCredentialsOnRefreshOnBody. If you want automatic refreshing, you will need to use the Strava node. I guess you are not using the Strava node because the resource/operation you need is unavailable. You can make a feature request here in the community to add missing functionality.

Ok, thanks for clarifying. I already voted on a feature that was requesting the ability to use, for example, Strava credentials on a HTTP Request node, and not the generic OAuth2 credential. Maybe one day :slight_smile:

Thanks

Hi @RicardoE105,

I decided to add the endpoint myself. Hope it can be merged soon. Thanks