【问题标题】:Google Cloud Resource Manager API Authentication with API Key使用 API 密钥进行 Google Cloud Resource Manager API 身份验证
【发布时间】:2017-05-19 15:05:49
【问题描述】:

根据https://cloud.google.com/resource-manager/docs/authorizing,可以使用 API 密钥授权请求。我无法让它工作。

我的请求如下所示:

curl -H "Content-Type: application/json" -X POST -d '{"key":"<Some Key>"}' https://cloudresourcemanager.googleapis.com/v1beta1/projects

回复:

{
  "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"
  }
}

非常感谢任何帮助。

【问题讨论】:

    标签: google-api


    【解决方案1】:

    对于任何非公开信息的请求,都需要 oAuth2。因此,从这个意义上说,文档具有误导性,因为 API 密钥对此类请求无效。

    您还可以通过选择特定调用并使用“试用此 API”来检查任何特定 api 调用所需的授权类型

    Example of projects.get

    这里是另一个堆栈溢出问题的链接,其中的答案解释了从这里去哪里

    Create Google Cloud Project with Cloud Resource Manager API

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-17
      • 1970-01-01
      • 1970-01-01
      • 2018-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-23
      相关资源
      最近更新 更多