Google Analytics OAuth Error | Windows Desktop

Describe the issue/error/question

When I create my web application credentials in the Google Developer Cloud for the OAuth client ID and put the client ID and secret it generates into the credential fields for n8n’s windows desktop version and click sign in, the consent screen throws an error.

I’ve added the OAuth Redirect URI as stated by the node into Google Developer Cloud and am wondering if this is either an error on the applications part or just the fact I’m attempting to access Google’s API from the desktop version.

What is the error message (if any)?

Error 400: redirect_uri_mismatch.

Share the output returned by the last node

No Output

Hi @Exius, welcome to the community!

This will most likely be a problem with the tunnel URL used by the desktop app which might have changed since you registered your application with Google.

To resolve this, you would need to add the current n8n redirect URL to the application you have registered with the Google Cloud Portal. Essentially repeating steps 4 and 5 from the respective documentation, but instead of creating new credentials you modify the existing one to allow Google to redirect users to your current n8n URL.

Let me know if you run into any trouble with this!

In order to avoid having to do this going forward you might want to consider hosting n8n on a web server with a static domain name or use n8n cloud.

Thanks for the quick response back to this.

I reviewed the information you sent over and the documentation, however all of this was done from a clean installation today so I’m pretty confident that the URL wouldn’t have had much time to change unless I am misunderstanding.

I downloaded and installed the desktop app a few hours ago and created an entirely new project for n8n on the Google Cloud Portal, so all of this was done within minutes of each other without any prior n8n files on my windows system.

This is also me making the assumption that the “current n8n URL” is the “OAuth Redirect URL” I am seeing on the Google Analytics node, is that correct?

If so, I can confirm that this is the same one I’m using with the Google Cloud Portal which still results in this error.

The redirect_uri_mismatch error message would be coming from Google and means the current GCP settings don’t allow the redirect you have requested.

I just gave this a go on my own side, with n8n showing a callback URL like this:

image

I added the full URL to the respective field in the GCP credentials settings after creating a brand-new project:

image

Opening the Sign in with Google link then takes me to the consent screen:

After allowing the connection I end up here:

So, if Google disallows the redirect without providing any further details you might need to reach out to their support team to learn more about why they would do so in your case.

It might also be worth to try and force a new tunnel URL by closing the desktop app, following the steps suggested here, and then restarting the app: Shopify Trigger Not working - #6 by MutedJam

Awesome, thanks for the assistance with this, I was finally able to get it to work!

I swore I had already tested adding in that URI, but I re-ran those steps and maybe I forgot to save the new redirect URI because it authenticates successfully now.

1 Like

Glad to hear this worked, thanks for confirming!