Crates.io | gcp_auth |
lib.rs | gcp_auth |
version | 0.12.3 |
source | src |
created_at | 2020-05-22 11:45:57.927873 |
updated_at | 2024-10-14 10:10:37.360773 |
description | Google cloud platform (GCP) authentication using default and custom service accounts |
homepage | |
repository | https://github.com/hrvolapeter/gcp_auth |
max_upload_size | |
id | 244541 |
size | 86,312 |
GCP auth provides authentication using service accounts Google Cloud Platform (GCP)
GCP auth is a simple, minimal authentication library for Google Cloud Platform (GCP) providing authentication using service accounts. Once authenticated, the service account can be used to acquire bearer tokens for use in authenticating against GCP services.
The library supports the following methods of retrieving tokens in the listed priority order:
GOOGLE_APPLICATION_CREDENTIALS
environment variable. Alternatively, custom service
account credentials can be read from a JSON file or string..config/gcloud/application_default_credentials.json
;
if found, use these credentials to request refresh tokens. This file can be created
by invoking gcloud auth application-default login
.gcloud
CLI tool, if it is available on the PATH
.For more detailed information and examples, see the docs.
This crate does not currently support Windows.
The default way to use this library is to select the appropriate token provider using provider()
. It will
find the appropriate authentication method and use it to retrieve tokens.
let provider = gcp_auth::provider().await?;
let scopes = &["https://www.googleapis.com/auth/cloud-platform"];
let token = provider.token(scopes).await?;
Parts of the implementation have been sourced from yup-oauth2.
Licensed under MIT license.