Cannot use N8N Google Auth with Localhost

I am using RunTipi latest version with n8n latest version, basically i am trying to create an integration that uses google docs, so i setup the credentials, insert the Client ID and Client Secret, and localhost since the local IP is not supported by google; Tried both going on production state and trying to login as showed in the second screen but every time i try it gives me the following error. Tried using ngrok to see if the error is persistent, tried setting in the file
/etc/hosts
/etc/hosts
a record
127.0.0.1 n8n-data-fake.com
127.0.0.1 n8n-data-fake.com
and setting google with that following fake dns record but still no changes
No description
No description
No description
11 Replies
AlphaRyze
AlphaRyzeOP4mo ago
@Nicolas I think there may be a problem on how runtipi parses the ip address maybe, i am sorry if i tag you but i didn't see anyone have a similar problem unfortunately and i think that this may be a serious bug if that is the case
Skullky
Skullky4mo ago
Hello, It looks like n8n is still using your IP address as OAuth Redirect URL, you need to make it aware of n8n-data-fake.com domain. The easiest way would be to : 1. Configure it in runtipi, check the linked picture. (you can keep other options activated at your own convenience) 2. Restart n8n 3. Access n8n via https://n8n-data-fake.com 4. Check the callback URI is now matching the one registered one in your Google Cloud App 5. Login into your Google Account
No description
Skullky
Skullky4mo ago
Can you elaborate your hypothesis ?
AlphaRyze
AlphaRyzeOP4mo ago
but i can keep the original 8215 port since by default n8n uses the ~5000 ish something port and he subdomain n8n.tipi.local correct?
No description
AlphaRyze
AlphaRyzeOP4mo ago
basically if this solution doesn't work out i suppose that something related to the configuration of IP parsing of RunTipi causes this error and since n8n does not send a device_id and device_name field it makes it impossible to use private ip's for google authentication
AlphaRyze
AlphaRyzeOP4mo ago
Now things changed actually, the errors changed to a URL mismatch
No description
No description
No description
No description
Skullky
Skullky4mo ago
What is the callback URL indicated by n8n in the credential creation form ? Shouldn't it be https://n8n-data-api.com/rest/oauth2-credential/callback ?
Nicolas
Nicolas4mo ago
Does the callback endpoint even responds? If you use n8n-data-api.com:8215 this won’t go through runtipi’s reverse proxy. It’s basically a direct call to your n8n container
AlphaRyze
AlphaRyzeOP4mo ago
i tried using a n8n-data-api.com route since if i used localhost nothing happened so i tried a solution that i finded on stack overflow regarding docker hosted instances of n8n right now it updated the callback URL
AlphaRyze
AlphaRyzeOP4mo ago
if i access from the direct ip of the server 192.168.0.21:8215 this is the output. If i try to access from the n8n dashboard from n8n-data-api.com OR n8n-data-api.com:8215 prob i need to set that dns record on my dns server as well ( i suppose ) If i access from n8n.tipi.local the callback is the same as the first case attached
No description
AlphaRyze
AlphaRyzeOP4mo ago
yep that was the issue To solve in case anyone needs it: 1. Add a fake dns record to your
/etc/hosts
/etc/hosts
file called
your-fake-domain.com
your-fake-domain.com
and assign it the ip
127.0.0.1
127.0.0.1
to point towards the local machine, then on google developer console put the URL:
https://your-fake-domain.com/rest/oauth2-credential/callback
https://your-fake-domain.com/rest/oauth2-credential/callback

Did you find this page helpful?