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”.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gcloud_rest_auth-4.1.5.tar.gz
.
File metadata
- Download URL: gcloud_rest_auth-4.1.5.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1021-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fd0a83fe13545ab71e0b2ccefceb4b19b09b54a9d9f9f85e336f9cec4151561 |
|
MD5 | e10bcb4738f6183045347fe86be82816 |
|
BLAKE2b-256 | 35c0d273d173b526055bc1b3c562babec64528bdc396e6e316fa9b4ca6318558 |
File details
Details for the file gcloud_rest_auth-4.1.5-py2.py3-none-any.whl
.
File metadata
- Download URL: gcloud_rest_auth-4.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1021-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 833aea3b0b06e7c6dae0a7ccf0844ef63233443066405f1c5e66d34a175f7d46 |
|
MD5 | df784e523eacce18ff83652383e6672b |
|
BLAKE2b-256 | 922e273adb763abfffc6e8f3b145c8412be0ea903dd35481116638e476a4c641 |