Google apps conection problem

So, recently I have started to use ngrok to communicate through telegram bot with my n8n workflow (self hosted n8n with docker). I created an API. I have the Client ID and the Client Secret, nothing wrong with it. Now when I’m “Signing in with Google” in the google calendar node (same with all google apps), I log in with the correct email, giving access, and then I have an error:

{"status":"error","message":"Unauthorized"}

Could it be because the OAuth Redirect URL contains ngrok http? Or is there another reason, and what is the solution?

* Windows 10
* Docker version 29.1.5
* Docker Compose version v5.0.1
* n8n version 2.4.8

@terivi The issue you are experiencing with the “Unauthorized” error is likely because of a mismatch in the OAuth Redirect URL between your ngrok URL and Google Cloud Console. The Problem:

When working with Google OAuth, the Redirect URL must match what is configured in the Google Cloud Console.

Add ngrok URL to Google Cloud Console (Quick Fix)
Get your current ngrok URL:
Start ngrok and note down your HTTPS ngrok URL (e.g., https://abc123.ngrok.io)
Add your ngrok URL to Google Cloud Console:
Go to: https://console.cloud.google.com/
Select your project
Go to: APIs & Services → Credentials
Select your OAuth 2.0 Client ID
Add in Authorized redirect URIs:

https://your-ngrok-url.ngrok.io/rest/oauth2-credential/callback

Save changes
Please note to use HTTPS ngrok URL instead of HTTP

Cheers!

2 Likes

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