airflow.providers.google.common.utils.id_token_credentials

You can execute this module to get ID Token.

python -m airflow.providers.google.common.utils.id_token_credentials_provider

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

ID_TOKEN="$(python -m airflow.providers.google.common.utils.id_token_credentials)" curl "https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${ID_TOKEN}" -v

Module Contents

Classes

IDTokenCredentialsAdapter

Convert Credentials with openid scope to IDTokenCredentials.

Functions

get_default_id_token_credentials(target_audience, request = None)

Gets the default ID Token credentials for the current environment.

Attributes

request_adapter

class airflow.providers.google.common.utils.id_token_credentials.IDTokenCredentialsAdapter(credentials)[source]

Bases: google.auth.credentials.Credentials

Convert Credentials with openid scope to IDTokenCredentials.

property expired(self)[source]

Checks if the credentials are expired.

Note that credentials can be invalid but not expired because Credentials with expiry set to None is considered to never expire.

refresh(self, request)[source]

Refreshes the access token.

Args:
request (google.auth.transport.Request): The object used to make

HTTP requests.

Raises:
google.auth.exceptions.RefreshError: If the credentials could

not be refreshed.

airflow.providers.google.common.utils.id_token_credentials.get_default_id_token_credentials(target_audience, request=None)[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.

Parameters
  • target_audience (Optional[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.

Returns

the current environment's credentials.

Return type

google.auth.credentials.Credentials

Raises

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

airflow.providers.google.common.utils.id_token_credentials.request_adapter[source]

Was this entry helpful?