Medium · HTTPS & Caddy
How to Fix OAuth 400: redirect_uri_mismatch (Google / Slack)
TL;DR Fix
n8n generated an internal localhost callback URL because WEBHOOK_URL was missing or lacked https://. Verify the OAuth Redirect URL shown in n8n Credentials starts with https:// before registering in Google Cloud Console.
Exact Error Signature
Error 400: redirect_uri_mismatch | callback URL shows http://localhost:5678
Copy-Paste Fix Commands
# Set exact public HTTPS domain in .env and restart:
WEBHOOK_URL=https://n8n.yourdomain.com/
N8N_EDITOR_BASE_URL=https://n8n.yourdomain.com/
docker compose up -d --force-recreate n8n
Preventing Recurrence
Verify the OAuth Redirect URL shown in n8n Credentials starts with https:// before registering in Google Cloud Console.