Invalid Google redirect URL during linking setup

I am encountering an “Invalid Redirect” error when configuring Google OAuth for n8n. The error message states, “must end with a public top-level domain (such as .com or .org).” I believe this is caused by the redirect URL n8n is generating, which differs from Google’s requirements. My n8n instance is running in a Docker container on a TrueNAS machine. How can I resolve this domain validation issue?

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @woriqowi The error occurs because the redirect URI is not a public FQDN (Fully Qualified Domain Name) but rather a local address (e.g., localhost) that includes a port, like :30109. Google requires a valid TLD such as .com or .org.

To resolve this for a local setup, you need to use a secure tunneling service that provides a public HTTPS endpoint, such as ngrok or Cloudflare Tunnel. Alternatively, you can utilize the native n8n tunnel by running the application with the tunnel command line flag.

More details can be found in this resource:

1 Like

Ah, I see the error in my configuration. The presence of the NGINX reverse proxy providing a public domain is insufficient; I need to ensure that domain is correctly mapped and declared within the n8n application itself via its environment variables to resolve the redirect URL issue.

Yes @woriqowi For the fastest solution, use ngrok. After installing and logging in via the instructions on ngrok.com like ngrok — Log in ), run the following command in your terminal:

ngrok http 30123

This generates a public HTTPS URL. Take that URL, append the necessary callback path specifically /reset/oauth2-credentials/callback and use the resulting full address as the redirect URL in your Google Cloud configuration.

2 Likes

thanks man this helps alot

you are welcome @woriqowi kindly mark as the solution if this helped you so others can find help with it.

1 Like

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