OAuth Redirect docker-compose

Good afternoon! How are they? I am new to the community and the truth is that the application is incredible, congratulations!

I had a query regarding the OAuth Redirect URI with Gmail.

I have installed n8n with docker-compose on a server, I already put DNS and IP Static on it.

I would like to know how I can configure the Redirect part to connect it with the Google Apps since the callback throws me localhost and google does not allow me.

Invalid Redirect: must end with a public top-level domain (such as .com or .org).

Thank you very much!!
Regardss,!

Hey @Internalit_Automatio,

Welcome to the community :rocket:

It sounds like it should just be a case of setting the WEBHOOK_URL environment variable or you can set the host option.

And in WEBHOOK_URL, which one would you place? because in the .env file I have the local domain in DOMAIN_NAME, how would I redirect that WEBHOOK to the local domain?Excuse my ignorance :frowning:

Hey @Internalit_Automatio,

If you have DOMAIN_NAME set then it would be something like WEBHOOK_URL=${DOMAIN_NAME}

Hey Jon, !

with docker compose I couldn’t initialize it, but with the command worked:
docker run -it --rm
–name n8n
-p 5678:5678
-v ~/.n8n:/home/node/.n8n
n8nio/n8n

The problem is that now after a certain time in AWS it appears “Connection Lost” in the Workflow and it does not reconnect

Hey @Internalit_Automatio,

Could be worth checking the docker logs to see if it shows any messages when it disconnects.

This errors:

GET https://n8n.domain.com/rest/push?sessionId=4f23wtlqvyi 524

/rest/node-icon/n8n-nodes-base.git:1 GET https://n8n.domain.com/rest/node-icon/n8n-nodes-base.git 403

Are you connecting directly to the instance or do you have a reverse proxy or similar in front?

I have a reverse proxy!, nginx

server {
listen 443 ssl; # n8n
server_name n8n.domain.name;
client_max_body_size 0;

location / {
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://ipaddress:5678/;
}
}

If you connect directly to the ip and bypass the proxy does it work?

I made a change and installed n8n in k8s and I no longer have the problem that it disconnects me, but I am having a problem that, for example, when I configure the gmail workflow when accepting the scopes, it throws me an error, and the webhook was also added in google platform.

URL ERROR: https://n8n.domain_name:5678/rest/oauth2-credential/callback?state=eyJ0b2tlbiI6IkZrODdaRnZnLWpnOUpmdDUtSUdvVi1qX2F1NVBEYjJrdGZmTSIsImNpZCI6IjEifQ%3D%3D&code=4/0AX4XfWiPoXa6BzwSApNGpdfgsb8rx_fdqHIanc1YtKGrounKw22pbSQ8mEjuxt3QA0rajw&scope=https://www.googleapis.com/auth/gmail.labels%20https://www.googleapis.com/auth/gmail.addons.current.action.compose%20https://www.googleapis.com/auth/gmail.addons.current.message.action%20https://mail.google.com/%20https://www.googleapis.com/auth/gmail.modify%20https://www.googleapis.com/auth/gmail.compose

Regards!!

Hey @Internalit_Automatio,

That looks like it is going to be a network issue. When you access n8n do you use https://n8n.domain_name:5678 or something else? I suspect it is going to be an environment option that isn’t set like the webhook url.

There, configure the URL with https without the port and with the variables domain, subdomain, host and webhook url and it worked perfectly for me.
Thanks u so much!!

Regards!!

1 Like