【发布时间】:2022-01-18 16:13:09
【问题描述】:
我正在尝试在 Google 身份管理中管理 SAML 和 OIDC 提供商。
他们的包目前似乎无法用于 Python 2,所以我正在尝试复制代码以使其工作。
要正确调用 API,我需要 Bearer Oauth Token。我在 google cloud sdk 文档中找不到任何 API。你们能帮我弄清楚如何获得 OAuth 令牌吗?
我尝试访问的 API 是 https://identitytoolkit.googleapis.com/v2beta1/projects/mca-shaurya-7/inboundSamlConfigs
显然得到验证错误
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"service": "identitytoolkit.googleapis.com",
"method": "google.cloud.identitytoolkit.v2beta1.ProjectConfigService.CreateInboundSamlConfig"
}
}
]
}
}```
But the URL mentioned in the response no longer exists.
【问题讨论】:
-
不要使用 Python 2。Google 两年前放弃了对该版本的支持。从 OAuth 2 上的此链接开始。developers.google.com/identity/protocols/oauth2
-
@JohnHanley 您能否发表您的评论作为答案,这将对社区有所帮助。
标签: firebase google-cloud-platform google-cloud-sdk