Google password change oauth 2.0 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 application has not been working, and I get:

'535-5.7.8 Username and password are not accepted. Read more in \ n535 5.7.8

I tried to uninstall the application and create a new one, but it does not seem to be taken away by the new changeable password. Any suggestions to fix this? I allowed less secure applications and displayed captcha unlock.

+6
source share
2 answers

@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 have only 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

+17
source

I solved this by updating the latest version of Nodemailer and removing the xoauth2 module, as Nodemailer 3 has better support for Oauth 2. While on the Google Oauth 2.0 Playground, I can get the correct access and update tokens.

+3
source

Source: https://habr.com/ru/post/1014896/


All Articles