You can execute this module to get ID Token.

python -m

To obtain info about this token, run the following commands:

ID_TOKEN="$(python -m" curl "${ID_TOKEN}" -v

Module Contents

class oauth2_credentials.Credentials)[source]

Bases: google.auth.credentials.Credentials

Convert Credentials with "openid" scope to IDTokenCredentials.

refresh(self, request)[source] Optional[str], request: google.auth.transport.Request = None) → google_auth_credentials.Credentials[source]
Gets the default ID Token credentials for the current environment.

Application Default Credentials provides an easy way to obtain credentials to call Google APIs for server-to-server or local applications.

  • target_audience (Sequence[str]) -- The intended audience for these credentials.

  • request (google.auth.transport.Request) -- An object used to make HTTP requests. This is used to detect whether the application is running on Compute Engine. If not specified, then it will use the standard library http client to make requests.


the current environment's credentials.

Return type



DefaultCredentialsError -- If no credentials were found, or if the credentials found were invalid.[source]

Was this entry helpful?