Authenticating into Node-RED using Google OAuth - Working Solution

Saw some questions in the forum about authenticating into Node-RED using Google OAuth, but couldn't find a working example.
So here is the code after I got it working with passport-google-oauth.

Please let me know if this works for you or not.

adminAuth: {
  type: "strategy",
  strategy: {
    name: "google",
    label: 'Sign in with Google',
    icon: "fa-google",
    strategy: require('passport-google-oauth').OAuth2Strategy,
    options: {
      clientID: 'some client id',
      clientSecret: 'some client secret',
      scope: 'email',
      callbackURL: "",
      verify: function (token, tokenSecret, profile, done) {
        profile.username = profile.emails.find(x => x.verified).value;
        done(null, profile);
  users: function (username) {
    return Promise.resolve({
      username: username,
      permissions: "*"

Does this need any settings in Google API's? Also, does it need a callback URL that is actually accessible by Google? (quite a lot of these API's don't).

Yes, this required generating a ClientId and ClientSecret at
The "Authorized redirect URIs" I entered there must match the callbackURL that I set in the strategy options in Node-RED.

Adding screenshots of the admin settings below.

Regarding whether the callback really needs to be accessible by Google, I'm afraid I don't know.
My Node-RED instance is publicly available but I don't know if this is a must.


That really helped. Thanks a lot!

Hi all!, i want to try this out.

Is there any update about it or is it fine with the initial code if @cowchimp ?