【问题标题】:Getting "Domain cannot use apis" when using Google Admin SDK Directory API使用 Google Admin SDK Directory API 时出现“域无法使用 api”
【发布时间】:2013-07-27 03:48:51
【问题描述】:

我正在尝试使用Admin SDK Directory API,专门用于检索Users: get endpoint 中详述的用户信息。

我在 oauth 时请求了以下权限

https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.user.readonly

但是,当我请求获取特定用户的信息时,我收到以下响应:

HTTP/1.1 403 Forbidden
Content-Type: application/json; charset=UTF-8
Date: Fri, 26 Jul 2013 18:25:29 GMT
Expires: Fri, 26 Jul 2013 18:25:29 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "domainCannotUseApis",
    "message": "Domain cannot use apis."
   }
  ],
  "code": 403,
  "message": "Domain cannot use apis."
 }
}

我已在 API Console 中启用了 Admin SDK。

我已在 Google Apps 标准(免费)版和 Google Apps for Nonprofits 版上尝试过此操作,但遇到了同样的错误。 Admin SDK Directory API 是否需要 Google Apps for Business 帐户?

【问题讨论】:

    标签: google-admin-sdk


    【解决方案1】:

    您需要在 G Suite 控制面板中enable the administrative APIs

    【讨论】:

    • 谢谢你,这有效。在得到你的帮助后,我终于注意到Directory API: Prerequisites中的细心读者清楚地指出了这一点。我失败了=(
    【解决方案2】:

    我很困惑。这是否意味着,如果我们的 App 列在 Google Apps Marketplace 中,安装我们 App 的域仍然需要手动启用管理 API?

    【讨论】:

    • 这确实有点奇怪
    • 正确。曾经有一个例外,市场应用程序可以只读访问旧的用户提要,但现在已经不存在了。我将提交功能请求。
    • 是的,这太烦人了,而且用户体验很糟糕!授予我们的应用程序权限后,我将不得不检测此错误并显示一条错误消息,说明如何打开它。即使我只需要只读的 GET 用户!蹩脚的。 @SteveBazyl 你提出功能请求了吗?
    • @SteveBazyl,感谢您对此的澄清。我终于能够通过以下方式获得一个模拟的服务帐户:1)手动启用管理 API 访问,2)启用使用者密钥,以及 3)在目标域管理面板中授权具有必要范围的服务帐户。话虽如此,这对我们的客户来说是一次糟糕的体验,也是之前市场体验的回归。记录功能请求后,能否请您回帖,以便我们对其进行投票?
    • 我相信许多其他人都在同一条船上。每个想要运行我的应用程序的客户都必须跳过很多障碍才能使用我的产品。可能会让他们在使用我的产品时三思而后行。 :-(
    猜你喜欢
    • 2013-06-06
    • 1970-01-01
    • 2013-11-23
    • 2015-03-05
    • 2014-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-09
    相关资源
    最近更新 更多