Shaurya Chaudhuri
Shaurya Chaudhuri

Reputation: 3842

How to get OAuth Tokens for Google Cloud SDK

I am trying to manage SAML and OIDC providers in Google Identity management.

Their package seems to be broken for Python 2 currently, so I am trying to copy the code to make it work.

To call the APIs properly I need the Bearer Oauth Token. I couldnt find any APIs that are there in google cloud sdk documentation. Can you guys help me figure out how to get the OAuth Token?

The API I am trying to access is https://identitytoolkit.googleapis.com/v2beta1/projects/mca-shaurya-7/inboundSamlConfigs

Obviously getting authentication error

{
  "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",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "CREDENTIALS_MISSING",
        "domain": "googleapis.com",
        "metadata": {
          "service": "identitytoolkit.googleapis.com",
          "method": "google.cloud.identitytoolkit.v2beta1.ProjectConfigService.CreateInboundSamlConfig"
        }
      }
    ]
  }
}```

But the URL mentioned in the response no longer exists.

Upvotes: 1

Views: 489

Answers (1)

John Hanley
John Hanley

Reputation: 81356

Do not use Python 2. Google dropped support for that version two years ago.

Python 2 support on Google Cloud

Start with this link on OAuth 2:

Using OAuth 2.0 to Access Google APIs

Upvotes: 1

Related Questions