Hi 
I’m having a problem with Google Sheets OAuth in n8n deployed on Render.
When I try to connect the Google credential, the callback it generates is:
http://localhost:5678/rest/oauth2-credential/callback
But my n8n is in production on Render, so it should use a public HTTPS URL.
I’ve configured my instance with environment variables like:
N8N_HOST
N8N_PROTOCOL=https
WEBHOOK_URL
N8N_EDITOR_BASE_URL
and yet it keeps using localhost in the redirect URI.
In Google Cloud Console I already tried adding the public URL, but the OAuth flow doesn’t work because n8n keeps redirecting to localhost.
Does anyone know what configuration I’m missing or what I’m doing wrong on Render for n8n to correctly generate the callback URL in production?
Thanks 
@Mari_Lu_Ortiz did Render actually redeploy the service after u set those env vars? n8n only picks them up at container start, so changes mid-flight dont propagate until u trigger a fresh deploy. also double-check N8N_HOST is just the hostname (no https://, no port) and WEBHOOK_URL is the full https://yoursite.onrender.com/ with trailing slash — wrong format and n8n silently falls back to localhost.
hi @Mari_Lu_Ortiz
the N8N_EDITOR_BASE_URL is what controls the callback URL, it needs to be without a trailing slash and include https://. Redirect URI: https://seu-app.onrender.com/rest/oauth2-credential/callback
confirm the variables with: docker exec -it <container_id> printenv
Deployment environment variables | n8n Docs
Hi @Mari_Lu_Ortiz
Add a Webhook Trigger node to a workflow. Look at the “Production URL” it generates. If it still says localhost, your WEBHOOK_URL variable is not being applied by Render. Let us know.
In general, the reason n8n keeps generating localhost in the OAuth callback is that it builds the redirect URL from the WEBHOOK_URL environment variable — and if that variable isn’t set correctly, or if conflicting variables like N8N_WEBHOOK_URL are present, n8n silently falls back to localhost:5678. Make sure you set WEBHOOK_URL=https://your-n8n-app.onrender.com/ (no N8N_ prefix) and remove any conflicting variants, then redeploy the Render service completely.
The other critical thing people miss is that the callback URL gets baked into the credential record at creation time. So even after fixing the env vars, your existing Google credential still has localhost saved inside it. You must delete that credential in n8n, create a brand new one, copy the new public callback URL it shows you, update it in Google Cloud Console under Authorized Redirect URIs, and then redo the OAuth flow — only then will it work end to end.