Skip to main content

Python Client for Google Cloud Auth

Project description

This is a shared codebase for gcloud-rest-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-rest-* 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-rest-auth) Python Version Support (gcloud-rest-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_rest_auth-4.2.3a0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

gcloud_rest_auth-4.2.3a0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file gcloud_rest_auth-4.2.3a0.tar.gz.

File metadata

  • Download URL: gcloud_rest_auth-4.2.3a0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/5.15.0-1030-aws

File hashes

Hashes for gcloud_rest_auth-4.2.3a0.tar.gz
Algorithm Hash digest
SHA256 eb25b8ee840af89ecf219e74cafeab09383645436d36031d506dee2ab354bcf4
MD5 da6c06617f8d502bc0dcd394ca2710f3
BLAKE2b-256 5bbf9be48c96ebee11d3664bcda6bc788f20d663d0d5b0b9edb94cba21fdf681

See more details on using hashes here.

File details

Details for the file gcloud_rest_auth-4.2.3a0-py3-none-any.whl.

File metadata

File hashes

Hashes for gcloud_rest_auth-4.2.3a0-py3-none-any.whl
Algorithm Hash digest
SHA256 e96b1824b25d451ba349ac9c7460dfae72fc7813f6ed62fdf924cde5f51d9903
MD5 cc997804847a9acff45cbd9a51ae3055
BLAKE2b-256 8c9d8aed3fcff82a25a5b334939870991115d00199976f4aa76c5a813bb326da

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