将Google Cloud Service帐户与群组电子邮件连接时出现问题

问题描述

我在Gsuite管理控制台中将[email protected]设置为电子邮件组。现在,我想使用我在使用nodemailer的node js中使用该电子邮件地址发送电子邮件。为此,我在Google Cloud中创建了服务帐户,并将[email protected]组添加为所有者。问题是,当我在节点应用程序中使用这些生成的凭据时,会抛出错误unauthorized_client

我在Gsuite的API权限中添加了client_id和必需的GMAIL范围。只有用户帐户可以使用服务帐户,而不能使用组电子邮件。

这是我的示例nodemailer代码

const smtpTransport = nodemailer.createTransport({
    host: 'smtp.gmail.com',port: 465,secure: true,auth: {
         type: "OAuth2",user: "[email protected]",serviceClient: "109120716xxxxxxxxxxxxxx",privateKey: "",}
});

我正在按照本教程来完成本https://medium.com/@imre_7961/nodemailer-with-g-suite-oauth2-4c86049f778a

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)