# Issue authenticating node-red-contrib-google-oauth2

**URL:** <https://discourse.nodered.org/t/issue-authenticating-node-red-contrib-google-oauth2/26185>\
**Category:** General\
**Created:** [6 May 2020 17:53 UTC](https://discourse.nodered.org/t/issue-authenticating-node-red-contrib-google-oauth2/26185 "2020-05-06T17:53:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![phreaq](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@phreaq](https://discourse.nodered.org/u/phreaq)\
**Post date:** [6 May 2020 17:53 UTC](https://discourse.nodered.org/t/issue-authenticating-node-red-contrib-google-oauth2/26185/1 "2020-05-06T17:53:18Z")

</div>

I am having some issues trying to authenticate the node-red-contrib-google-oauth2 node.

I have a Google Project set up, and have set up my credentials. When trying trying to configure the node, I key in my ClientID, and secret, but I also need to provide a 'scope' value. I don't see that in the documentation. I did some digging, and I am trying to use 'openid' as my scope. Is that correct?

When I hit the authenticate button, I get the following error;

```auto
## Error 400: redirect_uri_mismatch

The redirect URI in the request, http://node-red.example.com:8123/api/hassio_ingress/xxx/google-credentials/auth/callback, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit:...

```

I have the following values set up for my Authorized JavaScript origins:

```auto
http://192.168.xxx.xxx:8123 (has the proper IP)
http://localhost:8123

```

and the following under Authorized redirect URIs

```auto
https://xxx.ui.nabu.casa/api/hassio_ingress/xxx/google-credentials/auth/callback (with proper URL)
http://localhost:8123/google-credentials/auth/callback

```

any help?

---

<div class="post-metadata">

**Author:** ![mike2020](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mike2020](https://discourse.nodered.org/u/mike2020)\
**Post date:** [4 June 2020 07:37 UTC](https://discourse.nodered.org/t/issue-authenticating-node-red-contrib-google-oauth2/26185/2 "2020-06-04T07:37:58Z")

</div>

Hi,

I just hit the same issue and am currently still working oauth out myself, that said I have the node working now and in my case can query the classroom API fine.

The issue we hit is due to the node trying to workout the callback address based on the hostname you are using - if you have a private ip - it uses a dummy domain of '[node-red.example.com](http://node-red.example.com)' which is hard-coded into the nodes config. Now in my case internally I go directly to the server for access to the actually server, externally all traffic is reverse proxied through a nginx server which does have a domain name and only publishes some directories.

To get it working - you will need to setup external access for the callback url (I currently don't see oauth working if it isn't externally available) - if you have exactly the same url internally and externally - it will probably work fine otherwise I had to edit the google-auth.html file under /node\_modules/node-red-contrib-google-oauth2/ and add a callback="...."; line under the statement where it is setup normally.

As for the scope - the main node will list the scopes you need for the api you select, otherwise you can go to [https://developers.google.com/identity/protocols/oauth2/scopes](https://developers.google.com/identity/protocols/oauth2/scopes) and it lists the API scopes.

Hope this helps you or others having the issue.

---

<div class="post-metadata">

**Author:** ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)\
**Post date:** [10 July 2020 08:26 UTC](https://discourse.nodered.org/t/issue-authenticating-node-red-contrib-google-oauth2/26185/3 "2020-07-10T08:26:36Z")

</div>

For those googling. I lost an hour or so of my day today trying to figure it out.

In my case (I was configuring a node red instance that is running in the cloud accessed via a VPN) I just needed to add a entry to my local hosts file that pointed the vpn address to [node-red.example.com](http://node-red.example.com) such as

10.8.0.1 [node-red.example.com](http://node-red.example.com)

and after that it all worked like magic

---

<div class="post-metadata">

**Author:** ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)\
**Post date:** [10 July 2020 09:11 UTC](https://discourse.nodered.org/t/issue-authenticating-node-red-contrib-google-oauth2/26185/4 "2020-07-10T09:11:12Z")

</div>

Sorry after re reading it does not answer the original post.

To get scope initially choose the api in the config screen and it will give you a list of scopes. you will then need to add those on the next screen with client Id and secret

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 September 2020 09:11 UTC](https://discourse.nodered.org/t/issue-authenticating-node-red-contrib-google-oauth2/26185/5 "2020-09-08T09:11:19Z")

</div>

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