Google Cloud Resource Manager API Authentication with API Key

Viewed 309

According to https://cloud.google.com/resource-manager/docs/authorizing it's possible to authorize requests using an API key. I can't get it to work.

Here's what my request looks like:

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

Response:

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

Any help highly appreciated.

1 Answers

For any request for information that is not public oAuth2 is required. So in that sense the documentation is misleading as an API key is not valid for this kind of request.

You can also check what kind of authorisation any specific api call requires by selecting the specific call and Using the "Try this API"

Example of projects.get

Here is a link to another stack overflow question with an answer explaining where to go from here

Create Google Cloud Project with Cloud Resource Manager API

Related