Erreur pour lier le TRIGGER hubspot Ă  N8N erreur OAUTH2

Bonjour Ă  tous,

Je cherche de l’aide pour rĂ©soudre une sĂ©rie de problĂšmes d’authentification OAuth2 avec la connexion pour le TRIGGER Hubspot sur n8n, en version auto-hĂ©bergĂ©e (Docker + Traefik sur VPS Hostinger). Le module d’écriture hubspot fonctionne bien.

Avant d’entreprendre les tests SSH et les nombreux ajustements en terminal, voici ce qui posait problùme :

Situation avant interventions Terminal/SSH

- Au lancement de n8n (image officielle via Docker Compose, proxy Traefik), la connexion des credentials Hubspot ne fonctionnait pas.
- Quand je tentais d’ajouter un nouveau credential Hubspot dans n8n :
- La fenĂȘtre OAuth2 s’ouvrait correctement sur Hubspot
- Aprùs validation Hubspot, message avec problùme d’auth :
- Message “Invalid OAuth2 State” ou “authorization code not found”
- Parfois erreur “redirect_uri mismatch”
- Aucune credential Hubspot n’était enregistrĂ©e ni utilisable.
- Le redirect URI utilisé correspondait à celui conseillé dans la doc n8n (et Hubspot) :

- J’avais vĂ©rifiĂ© :
- Le paramĂ©trage de l’application Hubspot (Client ID & Secret, scopes standard, redirect URI bien prĂ©sent)
- La configuration docker-compose.yml pour les variables d’environnement n8n (HOST, PROTOCOL, PORT, WEBHOOK_URL
)

---

Actions tentées en SSH/Terminal

- Recréation complÚte du docker-compose.yml et des containers
- Mise Ă  jour Docker Engine et Docker Compose Ă  la derniĂšre version stable
- Ajustement Traefik (ports, socket, user, endpoint
)
- VĂ©rification/suppression des variables d’environnement parasites (DOCKER_HOST
)
- Purge images, volumes, cache Docker
- Restauration systÚme via snapshot Hostinger pour annuler tous les changements car ça commençait à poser problÚme pour se connecter
- Test de différents navigateurs/machines, suppression de cookies/cache

Infos techniques

- VPS Hostinger, accĂšs root SSH
- Docker Engine 29.0.2, Docker Compose v2.40.3
- Traefik v2/v3 selon essais, n8n docker.n8n.io/n8nio/n8n (derniĂšre version)
- Domaine principal : https://n8n.srv1057437.hstgr.cloud
- Scopes Hubspot : CRM, Workflow, basic contacts/read/write
- Redirect URI testé avec/et sans slash, HTTP et HTTPS

---

Ce que je cherche

- Une méthode fiable et précise pour lier n8n self-hosted à Hubspot via OAuth2
- Un retour d’expĂ©rience sur les subtilitĂ©s Ă  prĂ©voir pour l’authentification OAuth2 Hubspot sur un environnement Docker/Traefik/Hostinger
- Des logs ou endroits oĂč traquer l’erreur OAuth2 (n8n cĂŽtĂ© serveur, Hubspot, reverse proxy
)
- Toute suggestion sur la configuration, ou pistes documentées (reverse proxy, scopes, callback, sécurité, cookies
)

Merci d’avance pour votre aide.

Thomas

Hello everyone,

I’m looking for help solving a series of OAuth2 authentication issues with the HubSpot Trigger connection in n8n (self-hosted version using Docker + Traefik on a Hostinger VPS). The HubSpot write module works fine.

Before diving into SSH tests and extensive terminal tweaking, here’s what the situation looked like:

**Before any Terminal/SSH interventions**

- When launching n8n (official image via Docker Compose with Traefik proxy), HubSpot credentials authentication didn’t work.
- When trying to add a new HubSpot credential in n8n:
- The OAuth2 window opened correctly on HubSpot.
- After validating the connection, an authentication error message appeared:
- “Invalid OAuth2 State” or “authorization code not found.”
- Sometimes “redirect_uri mismatch.”
- No HubSpot credential was recorded or usable.
- The redirect URI used matched the one recommended in the n8n (and HubSpot) documentation:
[https://n8n.srv1057437.hstgr.cloud/rest/oauth2-credential/callback](https://n8n.srv1057437.hstgr.cloud/rest/oauth2-credential/callback
- I had checked:
- The HubSpot app configuration (Client ID & Secret, standard scopes, correct redirect URI)
- The docker-compose.yml configuration for n8n environment variables (HOST, PROTOCOL, PORT, WEBHOOK_URL, etc.)

---

**Actions attempted via SSH/Terminal**

- Complete rebuild of docker-compose.yml and containers
- Updated Docker Engine and Docker Compose to the latest stable version
- Adjusted Traefik configuration (ports, socket, user, endpoint, etc.)
- Checked and removed potential conflicting environment variables (e.g. DOCKER_HOST)
- Purged Docker images, volumes, and cache
- Restored the system via Hostinger snapshot to revert all changes once connectivity became unstable
- Tested different browsers/machines, and cleared cookies/cache

---

**Technical details**

- Hostinger VPS with root SSH access
- Docker Engine 29.0.2, Docker Compose v2.40.3
- Traefik v2/v3 (tested both), n8n docker.n8n.io/n8nio/n8n (latest version)
- Main domain: [https://n8n.srv1057437.hstgr.cloud](https://n8n.srv1057437.hstgr.cloud
- HubSpot scopes: CRM, Workflow, basic contacts/read/write
- Redirect URI tested both with and without trailing slash, and with HTTP and HTTPS

---

**What I’m looking for**

- A reliable and precise method to connect n8n self-hosted with HubSpot using OAuth2
- Any experience or insights about HubSpot OAuth2 quirks in a Docker/Traefik/Hostinger environment
- Log locations or tips to trace OAuth2 errors (on n8n server side, HubSpot, or reverse proxy)
- Any configuration advice or documented troubleshooting ideas (reverse proxy setup, scopes, callback handling, cookies, security aspects, etc.)

Thanks in advance for your help!

Bonjour @TCHRISTOPHE et bienvenue, c’est un plaisir de vous avoir ici !
Merci de demander à la Communauté HubSpot !
Je comprends que vous rencontrez des problĂšmes d’authentification OAuth2 avec n8n et HubSpot. De ce que je comprends, il s’agit ici d’un problĂšme d’intĂ©gration entre n8n et HubSpot, et non d’un problĂšme liĂ© Ă  la plateforme de dĂ©veloppement HubSpot.

Je pense que le problĂšme se situe au niveau de la configuration de n8n.
Pouvez-vous s’il vous plaĂźt vĂ©rifier les Ă©lĂ©ments qui peuvent bloquer :

- Mauvaise correspondance des URI de redirection entre n8n et les paramùtres de l’application HubSpot.
- ProblĂšmes de configuration du proxy Docker/Traefik
- ProblĂšmes de validation des paramĂštres d’état
Pour une aide spécifique à n8n :

- Consultez la documentation de n8n et les forums de la communauté n8n
- Vérifiez les paramÚtres de votre proxy inverse Docker/Traefik.
- Assurez-vous que HTTPS est correctement configurĂ© (nĂ©cessaire pour la production d’OAuth).
Si vous pensez qu’il y a un problĂšme avec HubSpot OAuth, veuillez fournir des messages d’erreur spĂ©cifiques Ă  HubSpot ou des rĂ©ponses Ă  l’API s’il vous plaĂźt.
Je voudrais aussi faire appel à quelques-uns de nos Experts: Bonjour @sylvain_tirreau, @GDiMaiolo et @Lucila-Andimol avez-vous d’autres suggestions pour aider @TCHRISTOPHE s’il vous plaüt ?
Bonne journée et merci par avance !
BérangÚre.