【发布时间】:2019-11-08 16:29:27
【问题描述】:
最终目标是在使用提供的访问令牌完成 OAuth 身份验证后获取用户组的列表。
在 OAuth 完成后,我目前无法从 Cloud Identity API 检索组列表。
Cloud Identity - Method: groups.list Documentation
步骤:
- 转到OAuth Playground
- 在列表底部输入您自己的范围,使用 "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
- 点击“授权API”按钮
- 选择要使用的谷歌帐户
- 允许“Cloud Identity Groups”
- 点击“交换授权码 令牌”按钮
- (可选)“在令牌过期之前自动刷新令牌。”
- 单击“列出可能的操作”选择“列出组” - 这 填充请求 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 密钥,并按照文档的要求添加 parent 参数。
有人可以帮忙提出一个有效的请求吗?
我尝试使用 OAuth 2.0 Playground、通过文档的“试用此 API”功能以及在本地使用各种选项来实现此功能,但我觉得我错过了一些简单的东西。
【问题讨论】:
标签: google-api google-oauth google-cloud-identity