Google OAuth Issues

I am having an issue setting up OAuth credentials for Google. My n8n instance is running on 192.x.x.x:5678 and not localhost. I am having difficulty figuring out how to set up api access to Google services. In Google console, if I enter the URI as localhost, it does not work on my end. And Google will not allow my specific host of 192.x.x.x as it requires .com, .org, etc for anything other than localhost.

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

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Problem Solved. I needed to set up a reverse proxy with nginx. I am now able to connect to Google with OAuth.

Specifically, in case someone is looking for the same info:

Edited the nginx.conf and added:

server {
	listen 5678;
	server_name localhost;

	location /rest/oauth2-credential/callback {
        proxy_pass http://{YOUR_SERVER_ADDRESS_HERE}:5678;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Then I added port mapping for 5678:5678. Restarted the nginx container, and was able to connect. Just a little added information, my nginx container is running on a different machine then my n8n container. So, you may need to change some things a little to suit your circumstances.

2 Likes

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