CloudAuthz

raw JSON →
0.6.0 verified Mon Apr 27 auth: no python

CloudAuthz is a Python library for delegating authorization on cloud-based resource providers. It supports AWS, GCP, and Microsoft Azure, providing a unified interface to obtain temporary credentials. Version 0.6.0 is the latest release, with an irregular release cadence.

pip install cloudauthz
error AttributeError: module 'cloudauthz' has no attribute 'CloudAuthz'
cause Incorrect import or older version without CloudAuthz class (v0.0.x).
fix
Upgrade to latest version: pip install -U cloudauthz
error KeyError: 'server_credentials'
cause Old config uses deprecated key 'server_service_account_credentials_filename' with v0.4.0+.
fix
Use 'server_credentials' in config dict.
breaking In v0.4.0, GCP config key changed from 'server_service_account_credentials_filename' to 'server_credentials'. Old config will raise KeyError.
fix Update config to use 'server_credentials' instead.
breaking In v0.6.0, GCP authorization flow replaced with client credentials (service account JSON). The old OAuth2 flow is removed.
fix Provide a service account JSON file or configure client credentials.
deprecated The 'get_credentials()' method returns a dict; its structure changed between versions. Check return keys before use.
fix Inspect returned dict for 'access_key', 'secret_key', 'session_token' (AWS) or 'access_token', 'expires_in' (GCP).

Initialize CloudAuthz and detect the cloud provider from environment. Requires cloud SDK credentials.

from cloudauthz import CloudAuthz
authz = CloudAuthz()
cloud_id = authz.get_cloud_id()
print(f"Cloud provider: {cloud_id}")