从OAuth-2.0游乐场访问Google Healthcare API时权限被拒绝

时间:2019-07-12 18:25:17

标签: api oauth-2.0 google-cloud-platform

我使用刷新令牌选项从OAuth 2.0 Playground向Google Healthcare API发出的请求无法正常工作。我正在获取“状态”:“ PERMISSION_DENIED”。所请求的API已启用许多天。这是请求和响应的详细信息。

    POST 
    /v1alpha2/projects/<project_id>/locations/<location>/datasets? 
    datasetId=<dataset_id> HTTP/1.1
    Host: healthcare.googleapis.com
    Content-length: 0
    Content-type: application/json
    Authorization: Bearer 
    HTTP/1.1 403 Forbidden
    Content-length: 767
    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, 12 Jul 2019 17:57:39 GMT
    X-frame-options: SAMEORIGIN
    Alt-svc: quic=":443"; ma=2592000; v="46,43,39"
    Content-type: application/json; charset=UTF-8
    {
    "error": {
"status": "PERMISSION_DENIED", 
"message": "Cloud Healthcare API has not been used in project <project_id> before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/healthcare.googleapis.com/overview?project=<project_ud> then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.", 
"code": 403, 
"details": [
  {
    "@type": "type.googleapis.com/google.rpc.Help", 
    "links": [
      {
        "url": "https://console.developers.google.com/apis/api/healthcare.googleapis.com/overview?project=<project_id>", 
        "description": "Google developers console API activation"
      }
    ]
  }
]

} }

1 个答案:

答案 0 :(得分:0)

您正在使用Healthcare API的Alpha端点,该端点已被Google停用。您可以在以下位置查看如何进行Beta API的转换:https://cloud.google.com/healthcare/docs/how-tos/transition-guide

还请注意,除了请求网址的更改

/v1beta1/projects/<project_id>/locations/<location>/datasets

现在的响应是一个长期运行的操作: https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets.operations