Skip to main content

Python Client for Google Cloud Auth

Project description

This is a shared codebase for gcloud-aio-auth and gcloud-rest-auth

This library implements an IamClient class, which can be used to interact with GCP public keys and URL sign blobs.

It additionally implements a Token class, which is used for authorizing against Google Cloud. The other gcloud-aio-* package components accept a Token instance as an argument; you can define a single token for all of these components or define one for each. Each component corresponds to a given Google Cloud service and each service requires various “scopes”.

Latest PyPI Version (gcloud-aio-auth) Python Version Support (gcloud-aio-auth) Python Version Support (gcloud-rest-auth)

Installation

$ pip install --upgrade gcloud-{aio,rest}-auth

Usage

See our docs.

CLI

This project can also be used to help you manually authenticate to test GCP routes, eg. we can list our project’s uptime checks with a tool such as curl:

# using default application credentials
curl \
  -H "Authorization: Bearer $(python3 -c 'from gcloud.rest.auth import Token; print(Token().get())')" \
  "https://monitoring.googleapis.com/v3/projects/PROJECT_ID/uptimeCheckConfigs"

# using a service account (make sure to provide a scope!)
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service.json
curl \
  -H "Authorization: Bearer $(python3 -c 'from gcloud.rest.auth import Token; print(Token(scopes=["'"https://www.googleapis.com/auth/cloud-platform"'"]).get())')" \
  "https://monitoring.googleapis.com/v3/projects/PROJECT_ID/uptimeCheckConfigs"

# using legacy account credentials
export GOOGLE_APPLICATION_CREDENTIALS=~/.config/gcloud/legacy_credentials/EMAIL@DOMAIN.TLD/adc.json
curl \
  -H "Authorization: Bearer $(python3 -c 'from gcloud.rest.auth import Token; print(Token().get())')" \
  "https://monitoring.googleapis.com/v3/projects/PROJECT_ID/uptimeCheckConfigs"

Contributing

Please see our contributing guide.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcloud_aio_auth-5.1.0a0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

gcloud_aio_auth-5.1.0a0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file gcloud_aio_auth-5.1.0a0.tar.gz.

File metadata

  • Download URL: gcloud_aio_auth-5.1.0a0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/5.15.0-1039-aws

File hashes

Hashes for gcloud_aio_auth-5.1.0a0.tar.gz
Algorithm Hash digest
SHA256 88e7bd39b2fd82d9d2367eaaf0e2d5bfffbcf69a38731035d0e36aa8a0d2c204
MD5 631c22546e5f613877203546367fa305
BLAKE2b-256 6dcb5db8181c54c927509291e474ab9bb51b6a0c3d897a916afae1964238994b

See more details on using hashes here.

File details

Details for the file gcloud_aio_auth-5.1.0a0-py3-none-any.whl.

File metadata

  • Download URL: gcloud_aio_auth-5.1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/5.15.0-1039-aws

File hashes

Hashes for gcloud_aio_auth-5.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 319b1bd6b2fcd57f81f90e157b8b5772f8e3516786370ca751ab5966c7b79b85
MD5 fb61201fb2b778cca68b4172e5b9a3f8
BLAKE2b-256 ab76ba99e893593e5454a230e1ed6595c44a6da8caa05b075584add8d8a44bb3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page