<I’m running N8N locally with Docker Compose and I’m trying to validate the credentials within N8N, but I’m getting an error when I try to log in to Google:
In the “Authorized redirect URIs” configuration, I’m entering the following: “http://localhost:5678/rest/oauth2-credential/callback”
The one provided by N8N, “http://host.docker.internal:5678/rest/oauth2-credential/callback”, is not accepted by Google, and I found this solution in a tutorial. I believe it might be related to this part. Does anyone know if there’s something I missed in the configuration? Can anyone help me?
Thank you for your help. Since I’ve already built the workflow based on the current environment, if I change the environment as you suggested, I’ll have to reconfigure everything again, right? I’m at that stage now, and I worked all day yesterday, its not a big deal but i wouldn’t want to lose what I’ve already done.
No worries, First download the workflow as backup for security and safety reason.
you won’t lose your existing workflows. Changing those environment variables and restarting n8n only updates how OAuth redirect URLs are generated. Your workflows, nodes, and credentials already stored will remain intact
if you haven’t configured a Docker volume for /home/node/.n8n, your data won’t persist after a container restart. I recommend double-checking your docker-compose.yml and ensuring you have a volume set up. If it’s already there, you’re safe and won’t lose workflows.
This leaves me with so many doubts. I understood your advice perfectly, but as a beginner on the platform, how can I tell if I have a volume set up in docker-compose.yml? Sorry if this is a basic question, but I’ve been struggling with this since yesterday using AI, and now I need to ask for help on the forum.
No worries, it’s not a basic question at all . To check if a volume is set up in your docker-compose.yml, look for a section under the n8n service like this:
services:
n8n:
image: n8nio/n8n
volumes:
./n8n_data:/home/node/.n8n
If you see a volumes line mapping something to /home/node/.n8n, that means your workflows, credentials, and settings are persisted outside the container.
If there’s no volume, your data will be lost when the container restarts. In that case, you should add the volume before restarting n8n to save your existing work
Thank you so much. I see there’s already a volume set up. So, just to confirm, should I now edit the existing n8n environment variables in the .yml file directly with the data you sent me right?
You can edit the existing environment variables in your docker-compose.yml directly to use localhost and the other settings I mentioned. Since you already have a volume set up, your workflows, credentials, and data will remain intact after restarting the container.
Generally, Docker Compose is not for beginners… Even a bare Docker requires a little amount of technical knowledge. For others, n8n cloud is better to use.
Sorry, just to avoid any chance of error, could you please confirm these last details for me:
In the current environment, should this data: WEBHOOK_URL: http://host.docker.internal:5678 be replaced with this: N8N_EDITOR_BASE_URL=http://localhost:5678/, resulting in: WEBHOOK_URL: ``http://localhost:5678/? Or should I replace it completely exactly as you sent it, resulting in: N8N_EDITOR_BASE_URL=http://localhost:5678/?
In the current environment, N8N_HOST: host.docker.internal should be changed to N8N_HOST: localhost. Is that correct?
I noticed these three settings are not in the current environment. Should I insert them exactly as they are? Where exactly should they go? Also, there is an existing ports: "5678:5678" in the current environment. Should I delete it and set it up as you instructed, or should I just change it to port: 5678?
I’m currently doing some tests without a domain to demonstrate the platform to clients and create some workflows at no cost. I plan to migrate and set up a domain later. I just started on the platform yesterday and spent the whole day setting up this first agent. The goal is to show it handling customer service and performing various actions within Google.
I added it like this, but it didn’t work. Please check if the configuration is correct. I couldn’t restart Docker in the terminal due to a duplicate ‘HOST’ line.