尝试允许服务帐户进行域范围委派时出现权限错误:“使用管理员帐户登录...”

问题描述 投票:0回答:1

我正在尝试从此处允许帐户进行域范围委托:

但是,点击“查看 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
google-cloud-platform nodemailer service-accounts
1个回答
0
投票

找到一些线索后回答我自己的问题:

  • Google 帐户与 Google Workspace 帐户(正式名称为 G Suite 帐户)不同
  • 您可以在 Google 帐号/Google Workspace 帐号下拥有 Google 服务帐号。但是,在您的 Google 帐户下拥有 Google 服务帐户并没有什么帮助,因为该服务帐户无法委派权限。
  • 仅拥有 Google Workspace 帐户(例如
    [email protected]
    )即可拥有 管理员角色和管理控制台e ,进而允许您向服务帐户授予全域委派。执行此委派后,您的服务帐户现在拥有工作区下所有帐户(例如
    [email protected]
    [email protected]
    )的访问权限,例如 Gmail。
© www.soinside.com 2019 - 2024. All rights reserved.