Hi,
I’m having an issue with Google Sheets OAuth2 authentication. The OAuth redirect URL is generated without the https:// protocol, causing Google to return “Error 400: invalid_request”.
Current (Wrong): n8n.[domainname].com/rest/oauth2-credential/callback
Expected (Correct): https://n8n``.[domainname].com/rest/oauth2-credential/callback
I’m running n8n via Coolify with reverse proxy (no port in URL). I’ve restarted the service multiple times and recreated credentials, but the issue persists.
What am I missing? How can I force n8n to generate the OAuth URL with https://?
Thanks!
Check the enviroment variables, N8N_HOST, and N8N_PUBLIC_NODE_BASE_URL (this one can be the issue here and maybe missing the “https://”)
Hi everyone,
I wanted to share the solution that finally worked for me regarding the OAuth redirect URL missing the https:// protocol issue.
Solution:
Instead of using the Environment Variables section in Coolify, I had to directly edit the Compose File:
-
Go to General > Edit Compose File
-
Add/modify these environment variables in the compose file:
- 'N8N_EDITOR_BASE_URL=https://n8n.yourdomain.com'
- 'WEBHOOK_URL=https://n8n.yourdomain.com'
- 'N8N_HOST=https://n8n.yourdomain.com'
Important: After making these changes, simply restarting is not enough. You need to:
-
Stop the service completely
-
Deploy it again
After redeploying, the OAuth redirect URL was generated correctly with https:// and Google Sheets authentication worked perfectly!
Hope this helps anyone facing the same issue with Coolify deployments.
Hey @isa_yilmaz,
To simplify this you only need to set WEBHOOK_URL unless you are planning to use a differnet url for the n8n editor.