Trouble configuring Gmail Credientals running on localhost using Ngrok

Describe the problem/error/question

Hello! I’m having some issues configuring my credentials for my Gmail account (using the Gmail OAuth2 API). When I attempt to connect, I get the following error:

Here’s my configuration for my credentials in Google. Notice that the Redirect URL is https://xxxx-xxx-xxx-xxx-xx.ngrok-free.app/rest/oauth2-credential/callback (the actual URL has a valid ID instead of x’s)

The forwarding URL in ngrok is https://xxxx-xxx-xxx-xxx-xx.ngrok-free.app (again, x’s replace the actual id, but it matches what’s in Google)

In my OAuth consent screen settings, I have my authorized domain listed as https://xxxx-xxx-xxx-xxx-xx.ngrok-free.app:

My scopes and test user is set up correctly as well.

I’ve tested the Sign in with Google button in Incognito mode as well. I’m using Firefox.

Any help would be much appreciated!

Cheers,
Bret


What is the error message (if any)?

You can’t sign in because this app sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error

If you are a developer of this app, see error details.

Error 400: redirect_uri_mismatch

Information on your n8n setup

  • n8n version: 1.60.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): localhost (n8n start)
  • Operating system: Windows 11
1 Like

Ah, I got it to work!!! Unfortunately, I don’t know why it worked, but here’s what I did:

Along with the ngrok address, I also entered both of these URLs:

http://localhost:5678/rest/oauth2-credential/callback
http://localhost/rest/oauth2-credential/callback

And it magically worked. Thanks!

2 Likes

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