title: Invalid login details in Nodemailer (Node.js)
body: <p>Been trying to implement a simple mail script using <b>nodemailer</b> in <b>node.js</b>. This implementation is based on the <b>Gmail API</b> and I used this <a href="https://github.com/andris9/nodemailer-smtp-transport" rel="nofollow">link</a> as reference. Now I am facing the below error </p>
  
  <pre><code>{ [Error: Invalid login]
  </code></pre>
  
  <p>code: 'EAUTH',
    response: '535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8  <a href="https://support.google.com/mail/answer/14257" rel="nofollow">https://support.google.com/mail/answer/14257</a> qe3sm505011pbc.73 - gsmtp',
    responseCode: 535 }</p>
  
  <p>And the fallowing is the code that I used </p>
  
  <pre><code>var nodemailer = require('nodemailer');
  var generator = require('xoauth2').createXOAuth2Generator({
      user: 'bharathvijay38',
      clientId: '***************',
      clientSecret: '***************',
      refreshToken: '***************',
      accessToken: '***************'
  });
  
  var transporter = nodemailer.createTransport({
      service: 'Gmail',
      auth: {
          user: 'xxxxx@xxxxx.xxx',
          pass: '************',
          xoauth2: generator
      }
  });
  
  transporter.sendMail({
      from: 'xxxxx@xxxxx.xxx',
      to: 'xxxxx@xxxxx.xxx',
      subject: 'hello!',
      text: 'Hello there !'
      }, function(error, info){
      if(error) {
          return console.log(error);
      }
  
      console.log("Message sent: "+info);
  });
  </code></pre>
  
  <p>I am new to node.js and server side scripting. So please kindly help me out </p>