# Help needed for 2FA with Authy

**URL:** <https://discourse.nodered.org/t/help-needed-for-2fa-with-authy/62764>\
**Category:** General\
**Created:** [17 May 2022 16:00 UTC](https://discourse.nodered.org/t/help-needed-for-2fa-with-authy/62764 "2022-05-17T16:00:16Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Topolynx](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/topolynx/32/32597_2.png) [@Topolynx](https://discourse.nodered.org/u/Topolynx)\
**Post date:** [19 May 2022 19:15 UTC](https://discourse.nodered.org/t/help-needed-for-2fa-with-authy/62764/7 "2022-05-19T19:15:55Z")

</div>

Ok, that is what I did.  
In my [Google console project dashboard](https://console.cloud.google.com/home/dashboard) I have first configured the OAuth consent screen. First step: User Type: **external**.

 ![Screenshot (157)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/47c57153ce6ec66ff38da828f7ffde99ca6c8f44.png)  
Saved and moved to the next step.  
Selected my email from the menu, filled the _Authorized domains_ and _Developer contact information_,  
saved and moved to the next step.

 ![Screenshot (158)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/606deab4acc91bcc974b9048c4a9ea1a34ed59d9.png)

 ![Screenshot (159)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/d/6d570abf0b0d3ae1e51962ce33584fa45939d501.png)

Added the scopes. In the Manually add scopes field I wrote email. Saved and moved to the last step.

 ![Screenshot (160)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5a6af03ece46e51f11ce6a2897504a8e004db01d.png)

Finally, I added my google email, Saved twice. OAuth consent screen configured.

![Screenshot (163)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9bafc0afadfcaa688ba95a897e37ecce4d92aafd.png)

Next step, I have created OAuth credentials. The following screenshot should be clear.

 ![Screenshot (155)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/8/385856948a622db2c8ae9ab75a5acc880957c145.png)

![Screenshot (156)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/5/35ddffc9ede6c5aef9d43f6f0743bb963e8708fb.png)

Now with the credentials I moved to configure node-red itself.

First, stop node-red.  
Installed passport-google-oauth20.

```auto
npm install passport-google-oauth20

```

Then I have changed the _adminAuth_ section to

```auto
    adminAuth: {
        type: "strategy",
        strategy: {
            name: "google",
            label: 'Accedi con Google',
            icon: "fa-google",
            strategy: require('passport-google-oauth20').Strategy,
            options: {
                clientID: 'your ClientID',
                clientSecret: 'your SecretKey',
                scope: 'email',
                callbackURL: "https://yournodered.yourdomain.xxx/auth/strategy/callback",
                verify: function (token, tokenSecret, profile, done) {
                    profile.username = profile.emails.constructor === Array ? profile.emails[0].value : null;
                    return done(null, profile);
                    }
                },
            },
            users: [
                { username: "youremail@gmail.com", permissions: ["*"]}
                ]
            },

```

Saved and restarted node-red.  
If everything is fine the new login screen should be like that:

 ![Screenshot (164)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/9/9932acc58071c003860a8dedcbb83dc4b22ab187.png)

That's all.  
I have commented the httpNodeAuth and httpStaticAuth sections because I would know if I can generate a password for my gmail new user as described [here](https://nodered.org/docs/user-guide/runtime/securing-node-red).

```auto
// httpNodeAuth: {user:"mebeforegoogleoauth",pass:"(see https://nodered.org/docs/user-guide/runtime/securing-node-red)"},
// httpStaticAuth: {user:"mebeforegoogleoauth",pass:"(see https://nodered.org/docs/user-guide/runtime/securing-node-red)"},

```

---

_[View the full topic](https://discourse.nodered.org/t/help-needed-for-2fa-with-authy/62764)._
