无法找到不太安全的应用程序设置

Unable to find Less Secure Apps setting

我们在 Nodemailer 中使用我们的 Gmail 凭据来发送开发中的测试电子邮件。我们今天尝试发送一个与昨天相同的配置,但收到以下错误:

2020-05-04T10:17:35.547Z Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at
04/05/2020 12:17:35 535 5.7.8 https://support.google.com/mail/?p=BadCredentials s18sm19281474wra.94 - gsmtp
04/05/2020 12:17:35 at SMTPConnection._formatError (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
04/05/2020 12:17:35 at SMTPConnection._actionAUTHComplete (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
04/05/2020 12:17:35 at SMTPConnection.<anonymous> (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
04/05/2020 12:17:35 at SMTPConnection._processResponse (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
04/05/2020 12:17:35 at SMTPConnection._onData (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
04/05/2020 12:17:35 at TLSSocket.SMTPConnection._onSocketData (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
04/05/2020 12:17:35 at TLSSocket.emit (events.js:310:20)
04/05/2020 12:17:35 at addChunk (_stream_readable.js:286:12)
04/05/2020 12:17:35 at readableAddChunk (_stream_readable.js:268:9)
04/05/2020 12:17:35 at TLSSocket.Readable.push (_stream_readable.js:209:10)
04/05/2020 12:17:35 2020-05-04T10:17:34.439Z RES e77bea28-7092-4ec5-81b7-8230bd068e5a POST /projects/111/items 201 1117
04/05/2020 12:17:35 2020-05-04T10:17:35.588Z Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at
04/05/2020 12:17:35 535 5.7.8 https://support.google.com/mail/?p=BadCredentials p7sm18057972wrf.31 - gsmtp
04/05/2020 12:17:35 at SMTPConnection._formatError (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
04/05/2020 12:17:35 at SMTPConnection._actionAUTHComplete (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
04/05/2020 12:17:35 at SMTPConnection.<anonymous> (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
04/05/2020 12:17:35 at SMTPConnection._processResponse (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
04/05/2020 12:17:35 at SMTPConnection._onData (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
04/05/2020 12:17:35 at TLSSocket.SMTPConnection._onSocketData (/home/node/backend/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
04/05/2020 12:17:35 at TLSSocket.emit (events.js:310:20)
04/05/2020 12:17:35 at addChunk (_stream_readable.js:286:12)

我做了一些研究,发现我应该打开 "Less secure apps" 但我找不到设置。

当我访问 https://myaccount.google.com/lesssecureapps 时,我得到 "Settings could not be read"

如果您是 Gsuite 管理员,则需要将其迁移到 oAuth。 我不知道 google 是否暂时或永久禁用了 LSA。

https://gsuiteupdates.googleblog.com/2019/12/less-secure-apps-oauth-google-username-password-incorrect.html

LSA 已返回安全设置,我猜它已关闭一段时间。

这是 Google 方面的暂时性问题。到 11:44 UTC 时,我们回来了。 https://twitter.com/gsuite/status/1257266044957319169?s=20

我们设法使用应用密码快速修复了它。对于使用 Less Secure Apps 登录的任何人来说,这是一个微不足道的修复。您只需要设置 2FA(如果您还没有)并使用生成的应用程序密码从您的应用程序登录,而不是标准密码。

https://support.google.com/accounts/answer/185833

这比迁移到 OAuth 更容易,对于任何急于在生产中解决此问题的人来说,OAuth 通常是唯一的选择。