Skip to content
Advertisement

Google oauth 2.0 API password change Username and Password not accepted

I have a form using nodemailer, xoauth2 with google APi oauth2, I updated the password last week and since then my app hasn’t worked and I get:

‘535-5.7.8 Username and Password not accepted. Learn more atn535 5.7.8

I’ve tried deleting the app and creating a new one, but its doesnt seem to pick up the new changed password. Any suggestions to how to fix this? I have allowed less secure apps, and display unlock captcha.

Advertisement

Answer

@sambellerose I went from

const generator = xoauth2.createXOAuth2Generator({
  user: serverConfig.gmail.client_user,
  clientId: serverConfig.gmail.client_id,
  clientSecret: serverConfig.gmail.secret,
  refreshToken: serverConfig.gmail.refresh_token,
  accessToken: serverConfig.gmail.access_token,
});


const transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    xoauth2: generator,
  },
});

To just having the following:

const transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    type: 'OAuth2',
    user: serverConfig.gmail.client_user,
    clientId: serverConfig.gmail.client_id,
    clientSecret: serverConfig.gmail.secret,
    refreshToken: serverConfig.gmail.refresh_token,
    accessToken: serverConfig.gmail.access_token,
  },
});

I hope this helps

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement