* I’m self-hosting the latest n8n Docker image on **[Render.com](http://render.com/)**

Hi n8n community,

I’m facing an issue while trying to set up Google OAuth2 credentials in n8n and would appreciate any help or guidance. I’m relatively new to n8n and self-hosting, so step-by-step instructions would be incredibly helpful! Here’s a detailed explanation of the problem:

Setup Details:

  • I’m self-hosting the latest n8n Docker image on Render.com.
  • I’ve followed the official documentation and multiple tutorials to set up Google OAuth2 credentials.
  • My OAuth Redirect URL in the Google Cloud Console is set to:
    http://localhost:5678/rest/oauth2-credential/callback

The Problem:

When I enter my Client ID and Client Secret in the n8n Google Calendar OAuth2 API node and proceed to sign in to my Google account, I:

  1. Select my Google account.
  2. Grant all the required permissions.
  3. Click “Allow.”

At this point, instead of being redirected back to n8n, I’m taken to a page with the following error:
This site can’t be reached localhost refused to connect. ERR_CONNECTION_REFUSED

What I’ve Tried:

  • Verified the OAuth Redirect URL multiple times to ensure it matches the one in the Google Cloud Console.
  • Confirmed that the n8n instance is running and accessible.
  • Checked for any proxy or firewall issues but didn’t find anything blocking the connection.

Additional Context:

  • I’m using Render.com to host n8n, and the instance is running without any other apparent issues.
  • I’m not using a custom domain or any reverse proxies (e.g., Nginx, Traefik).
  • I’ve double-checked the Google Cloud Console settings (e.g., authorized domains, redirect URIs) to ensure they align with the documentation.

Since I’m a complete noob to n8n and self-hosting, I’d really appreciate it if someone could guide me step-by-step to resolve this issue.

If any additional information would help diagnose the issue, please let me know, and I’ll provide it.

Thanks in advance for your help!


Not really familiar with what render is or what it does, but… the issue is rather clear.

Instead of a localhost, you should give Google a public hostname or a public IP address which it can use to redirect you back to n8n (it obviously cannot use 127.0.0.1, because this means “me” and google OAuth authorization server is definitely not hosting your n8n). What is the URL you use to access you workflows?

n8n.io - Workflow Automation this is my url to acces , i know but how can i do the call back from google to my local host ? thanks a lot

You don’t need to call back from google YOUR localhost, you need to call back to the host which runs your n8n.

Hi, i was also facing the similar issue took me several searches and chatgpt troubleshoots to get it right, the problem is the OAuth url in google cloud must be a public accessible url and must be HTTPS for this you have to manually set some env variables in render project,

Key Value
N8N_HOST your-n8n.onrender.com
N8N_PORT 443
N8N_PROTOCOL https
WEBHOOK_TUNNEL_URL https://your-n8n.onrender.com
N8N_EXTERNAL_BACKEND https://your-n8n.onrender.com
VUE_APP_URL_BASE_API https://your-n8n.onrender.com/

This configures, n8n to use HTTPS (the n8n_port and n8n_protocol) , which was the main issue, you will know it has worked when, the OAuth Redirect URL in n8n looks like this
https://your-n8n-instance.onrender.com/rest/oauth2-credential/callback

1 Like