Google Cloud Rest API Authentication through Service Account

170 views Asked by At

I invoking google cloud rest API from postman. As per google documentation, I have created Service Account and download key json file and json file contents are as below

  "type": "service_account",
  "project_id": "myproject",
  "private_key_id": "<KeyID>",
  "private_key": "<Key>",
  "client_email": "[email protected]",
  "client_id": "<client_id>",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "cert_url",
  "universe_domain": "googleapis.com"

I not sure, how to use above credentials while invoking google cloud rest api in postman.

E.g. Endpoint - Get list of all projects in given orgnization. Service Account has all necessary permission to read the data from all project.

https://cloudresourcemanager.googleapis.com/v3/projects

I tried to use private key from credentials as postman as bearer token but did not work but got below error. I also checked documentation but it very confusing.

"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"
0

There are 0 answers