Google OAuth not working on Docker with custom port (5679 instead of 5678)

Dear n8n team and Google API specialists,

I’m running a self-hosted n8n instance via Docker, but on port 5679 instead of the default 5678. When trying to authenticate using Google OAuth, the connection fails — I either receive no response or just an empty one. [3]

I reported this on GitHub (issue #17084), but the bot redirected me here, stating that it’s not considered a bug. However, I suspect the issue is related to how n8n handles non-standard ports during the OAuth flow.


Steps to Reproduce

  1. Install n8n via Docker, using port 5679 instead of 5678
    Official Docker guide
  2. Enable and configure Google API access
    Google OAuth credential setup
  3. Add the App user to the Google Cloud project
    Community thread

The Docker container is hosted on a Windows-based notebook, and port 5679 is exposed via TCP through my Fritz!Box router.


Expected Behavior

Google OAuth authentication should work correctly even when n8n is running on a non-default port like 5679.


Actual Behavior

The OAuth flow fails. The browser redirects as expected, but the callback either times out or returns an empty response.
Port 5679 is properly mapped and publicly accessible via instance.myfritz.net:5679.


System Information

  • n8n version: 1.76.1
  • Node.js version: as provided in Docker
  • Operating system: WSL (Ubuntu) + Docker on Windows
  • Execution mode: main (default)
  • Database: PostgreSQL
  • Running n8n via: Docker

Google Cloud Project – Redirect URIs [2]

The following redirect URIs have been configured in the Google Cloud Console:

bash

KopierenBearbeiten

http://myfritz-url.net:5678/rest/oauth2-credential/callback
http://myfritz-url.net:5679/rest/oauth2-credential/callback

Despite this, the OAuth authentication does not succeed.


Questions

  • Does n8n internally expect port 5678 even if a different port is configured?
  • Are there specific adjustments or environment variables needed to support OAuth on custom ports?
  • Is this behavior due to Google OAuth limitations, or is it something n8n-related?

Any suggestions, confirmation, or workarounds would be greatly appreciated — thank you!


References / Screenshots:

[1]

[2]

[3]

Seems like you are missing the WEBHOOK_URL environment variable.
You can set it to https://instance.myfritz.net:5679

1 Like

Hi i am facing similar issue but not like this have attached webhook URLs but the issue is i am facing connection time out this site can’t be reached like that URl and everything is correct can anyone help?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.