title: Invalid login on create user event when working with Cloud Functions for Firebase and node mailer
body: <p>I am using Cloud Functions for Firebase and Nodemailer and putting together code to fire welcome email. Following is the code I have:</p>
  
  <pre><code>const functions = require('firebase-functions');
  
  const admin = require('firebase-admin');
  admin.initializeApp(functions.config().firebase);
  
  const nodemailer = require('nodemailer');
  const gmailEmail = encodeURIComponent(functions.config().gmail.email);
  const gmailPassword = encodeURIComponent(functions.config().gmail.password);
  
  const mailTransport = nodemailer.createTransport(
  `smtps://${gmailEmail}:${gmailPassword}@smtp.gmail.com`);
  const APP_NAME = 'Test';
  
  exports.sendWelcomeEmail = functions.auth.user().onCreate(event =&gt; {
      const user = event.data; // The Firebase user.
      const email = user.email; // The email of the user.
      const displayName = user.displayName; // The display name of the user.
  
      return sendWelcomeEmail(email, displayName);
  });
  
  
  function sendWelcomeEmail(email, displayName) {
      const mailOptions = {
          from: '"Test" &lt;noreply@test.com&gt;',
          to: email
      };
  
      // The user subscribed to the newsletter.
      mailOptions.subject = `Welcome to hell!`;
      mailOptions.text = `Hey I hope you will enjoy our service.`;
      return mailTransport.sendMail(mailOptions).then(() =&gt; {
          console.log('New welcome email sent to:', email);
      });
  }
  </code></pre>
  
  <ul>
  <li>I do have Allow Less secure Apps turned on</li>
  <li>I do see my gmail address and password in the config. I have verified this by typing <code>firebase functions:config:get</code> in the command line</li>
  </ul>
  
  <p>I am getting the following error
  <a href="https://i.stack.imgur.com/i2l2H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i2l2H.png" alt="Invalid Login even when credentials are correct"></a></p>