【问题标题】:How to get OAuth Tokens for Google Cloud SDK如何获取 Google Cloud SDK 的 OAuth 令牌
【发布时间】: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


【解决方案1】:

不要使用 Python 2。Google 两年前放弃了对该版本的支持。

Python 2 support on Google Cloud

从 OAuth 2 上的此链接开始:

Using OAuth 2.0 to Access Google APIs

【讨论】:

    猜你喜欢
    • 2021-09-07
    • 1970-01-01
    • 1970-01-01
    • 2012-08-03
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 1970-01-01
    • 2011-08-21
    相关资源
    最近更新 更多