从 cloudidentity.googleapis.com returns INVALID_ARGUMENT 错误中获取组列表

GET list of groups from cloudidentity.googleapis.com returns INVALID_ARGUMENT error

最终目标是在使用提供的访问令牌完成 OAuth 身份验证后获取用户组的列表。

OAuth 完成后,我目前无法从 Cloud Identity API 检索群组列表。

Cloud Identity - Method: groups.list Documentation

步骤:

GET /v1/groups HTTP/1.1
Host: cloudidentity.googleapis.com
Content-length: 0
Authorization: Bearer [TOKEN]
HTTP/1.1 400 Bad Request
Content-length: 127
X-xss-protection: 0
X-content-type-options: nosniff
Transfer-encoding: chunked
Vary: Origin, X-Origin, Referer
Server: ESF
-content-encoding: gzip
Cache-control: private
Date: Fri, 08 Nov 2019 16:12:32 GMT
X-frame-options: SAMEORIGIN
Alt-svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
Content-type: application/json; charset=UTF-8
{
  "error": {
    "status": "INVALID_ARGUMENT", 
    "message": "Request contains an invalid argument.", 
    "code": 400
  }
}

我只能得到状态为 INVALID_ARGUMENT 的无效参数。 我已经尝试从我自己的项目中提供一个 API 密钥,并根据文档的要求添加父参数。

有人可以帮忙处理一个有效的请求吗?

我尝试使用 OAuth 2.0 Playground、'Try this API' 功能通过文档和本地使用各种选项来实现这一点,我觉得我缺少一些简单的东西。

目前,Cloud Identity 组 API 仅提供对 Identity Mapped Groups 的访问权限,这使其仅在 Cloud Search 上下文中相关。

要访问 "regular" 个组,请使用 Directory API

您需要确保在 parent 查询参数中传递的值有效。 URL 应如下所示:

https://cloudidentity.googleapis.com/v1/groups?parent=customers/**your_customer_id_which_can_be_found_in_the_admin_console**

不确定这是否仍然与您相关,首先您需要通过父级,还需要为您的 customer_id 添加前缀。

Must be of the form identitysources/{identity_source_id} for external- identity-mapped groups or customers/{customer_id} for Google Groups. The customer_id must begin with "C" (for example, 'C046psxkn').

所以 url 看起来真的应该是这样的,

https://cloudidentity.googleapis.com/v1/groups?parent=customers/C&access_token=