【问题标题】:nodemailer OAuth2 gsuite (mail@example.com) serviceClient and privateKey confignodemailer OAuth2 gsuite (mail@example.com) serviceClient 和 privateKey 配置
【发布时间】:2021-05-19 18:21:56
【问题描述】:

Nodemailer documentation for 2LO 声明您可以进行这样的配置设置:请注意,我使用的是由 gsuite 托管的唯一网络地址 example.com

host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
  auth: 'OAuth2',
  user: 'mail@example.com',
  serviceClient: emailKey.client_id,
  privateKey: emailKey.private_key,
}

并且您可以根据most up-to-date tutorial I can find 使用正确的配置创建一个 gcp 服务帐户。但是它给出了这个错误:

错误:缺少“PLAIN”的凭据...代码:'EAUTH',命令:'API'

在这方面没有解决的问题,here 是一个供参考。

我发现的相关堆栈溢出问题中的所有“已接受答案”都已过时,因为 GCP 服务帐户的 JSON 输出不再包含刷新和访问令牌。 This one 虽然看起来像它的 gmail 特定的。

有什么建议吗?我是否需要使用设置的访问令牌?因为我找不到有关如何执行此操作的良好文档。也许是相关的谷歌文档,因为我无法区分哪个是唯一的网址,哪个是@gmail.com 特定的。

【问题讨论】:

    标签: gmail gmail-api nodemailer google-gsuite


    【解决方案1】:

    您输入的是auth: 'OAuth2' 而不是type: 'OAuth2'

    【讨论】:

      猜你喜欢
      • 2020-12-20
      • 1970-01-01
      • 2012-06-07
      • 2021-04-11
      • 2018-12-22
      • 2021-09-22
      • 2018-01-05
      • 1970-01-01
      • 2021-06-15
      相关资源
      最近更新 更多