Permission denied while accessing Google Healthcare API from OAuth-2.0 playground

737 Views Asked by At

My request to google healthcare API is not working from OAuth 2.0 playground using refresh token option. I am getting "status": "PERMISSION_DENIED". The requested API has been enabled for many days. Here's the Request and Response details.

    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

There are 1 best solutions below

1
On BEST ANSWER

You are using the Alpha endpoint for the Healthcare API, which has been decomissioned by Google. You can see how to make the transition for the Beta API in here: https://cloud.google.com/healthcare/docs/how-tos/transition-guide.

Also note that in addition to the change in the Request URL

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

the response now is a long-running operation: https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets.operations