我正在尝试从此处允许帐户进行域范围委托:
但是,点击“查看 Google Workspace 管理控制台”会将我重定向到登录屏幕,即使我尝试使用服务帐户登录该帐户,也会收到此错误:
我的理解是,我需要有一个Google服务帐户才能允许我的应用程序(在生产中)能够访问gmail,这就是我需要一个服务帐户的原因。 请帮助我了解如何允许此服务帐户的域范围委托权限。服务帐号与 Google Workspace 帐号和 Google Cloud Identity 有何关联? 我正在尝试将 Gmail API 与 Nodemailer 一起使用,如下所示:
try {
let transporter = await nodemailer.createTransport({
service: "gmail",
auth: {
type: "OAuth2",
user: '[email protected]',
serviceClient: process.env.SERVICE_CLIENT,
privateKey: process.env.PRIVATE_KEY,
},
});
const mailOptions = {
错误:
Sign in with an administrator account
To sign in to admin.google.com, use an administrator account for a managed Google service, such as Google Workspace or Cloud Identity. Learn more about Google accounts
找到一些线索后回答我自己的问题:
[email protected]
)即可拥有 管理员角色和管理控制台e ,进而允许您向服务帐户授予全域委派。执行此委派后,您的服务帐户现在拥有工作区下所有帐户(例如 [email protected]
或 [email protected]
)的访问权限,例如 Gmail。