从cloudidentity.googleapis.com获取组列表返回INVALID_ARGUMENT错误

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

OAuth完成后,我目前很难从Cloud Identity API检索组列表。

Cloud Identity - Method: groups.list Documentation

步骤:

  • 转到OAuth Playground
  • 使用以下方法在列表底部输入您自己的范围 “ https://www.googleapis.com/auth/cloud-identity.groups.readonly
  • 点击“授权API”按钮
  • 选择要使用的Google帐户
  • 允许“云身份组”
  • 点击“ 令牌”按钮
  • (可选)“在令牌过期前自动刷新。”
  • 单击“列出可能的操作”,然后选择“列出组”。 填充请求URI。点击“发送请求”
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”功能以及在本地使用各种选项来实现此目的,我觉得我缺少一些简单的东西。

mysetry 回答:从cloudidentity.googleapis.com获取组列表返回INVALID_ARGUMENT错误

当前,Cloud Identity groups API仅提供对 Identity Mapped Groups 的访问,这使其仅与Cloud Search上下文相关。

要访问“常规”组,请使用Directory API

,

您需要确保在Win64查询参数中传递有效值。该网址应如下所示:

parent

,

不确定这是否仍然与您相关,首先您需要传递 parent,并且您还需要为您的 customer_id 添加前缀。

print (out.reset_index().apply(lambda x: f'number ({x["index"]}) appears : {x[0]} times',axis=1))
0      number (0) appears : 5 times
1      number (1) appears : 4 times
2      number (2) appears : 3 times
3      number (3) appears : 3 times
4      number (4) appears : 3 times
5      number (5) appears : 0 times
6      number (6) appears : 2 times
7      number (7) appears : 2 times
8      number (8) appears : 0 times
9      number (9) appears : 3 times
10    number (10) appears : 0 times
dtype: object

所以网址应该看起来像这样,

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

本文链接:https://www.f2er.com/3136447.html

大家都在问