N8N locally and google

Describe the problem/error/question

I am unable to connect to my google account. I am getting the below error when I click on “sign in with google”.

What is the error message (if any)?

Please share your workflow

So I am using docker compose to locally host my n8n instance. I pretty much used this Docker Compose | n8n Docs

However the autho2 doesn’t like my .local so I tried http://localhost:5678/rest/oauth2-credential/ callback. However I still got the above error. Thank you for your help.

(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:

Hi @Unfounded8673,

Have you followed the instructions to setup the credentials page and enable the apis you require on Google? Ensure the google account is set to have your gmail account as a test account in your Google Oauth consent screen setup if you are using External

1 Like

Yes I did that.

You need to use https and a qualified domain name for your local instance to use OAuth with it.

In easy words: You cannot use http://localhost:5678 but would need something like https://yourdomain.tld

Usually this is done by buying a domain name and setting up cloudflare tunnels or ngrok or any other reverse proxy solution.

There are a lot of great guides out there for this setup. Here is just one from a community member: Securely Self-Hosting n8n with Docker & Cloudflare Tunnel (The... Arguably Less-Painful Way)

1 Like

You can setup tailscale with tailscale funnel @Unfounded8673 It’s free and really easy to setup. I don’t recommend cloud-fare as it has a more complicated setup.

For google auth you can use localhost as all this is, is a redirect in your browser which will always find localhost

thats what I thought. It still doesn’t fix my error, though. So what is the fix then? I rather not expose it to the internet.

Hi @Unfounded8673 under the Oauth concent page on google cloud, click clients and make sure you added your localhost url under the “Authorised redirect URIs” section:

I do. It still doesn’t work

This is odd. What version of n8n are you using? I feel the best way to move forward is to perhaps jump on a quick google meet or something and walk through your setup.

this is the error I am getting Error 400: invalid_request

Request details: redirect_uri=https://n8n.danielanderson.local/rest/oauth2-credential/callback flowName=GeneralOAuthFlow. And yea I would like that. How would you like to set that up\

What time zone are you in? Would love to setup a google meetup. If you want to know my setup its literally copy and pasted Docker Compose | n8n Docs . I didn’t change anything

Hi @Unfounded8673, Let me DM you

It is still not working. I am getting a Request details: redirect_uri=https://n8n.danielanderson.local/rest/oauth2-credential/callback flowName=GeneralOAuthFlow error. I think it has to do with the URI mismatch but I am not sure.