| Crates.io | gcloud-identity-token |
| lib.rs | gcloud-identity-token |
| version | 0.2.0 |
| created_at | 2025-07-31 20:45:00.942434+00 |
| updated_at | 2025-11-05 15:30:56.359608+00 |
| description | A secure OAuth token client for Google Cloud |
| homepage | https://github.com/casonadams/gcloud-identity-token |
| repository | https://github.com/casonadams/gcloud-identity-token |
| max_upload_size | |
| id | 1775728 |
| size | 98,144 |
A Rust crate for seamless, secure Google Cloud OAuth authentication.
This library handles the OAuth2 authorization code flow (with browser-based login) to obtain:
It securely caches credentials using the OS-native keyring or a file-based fallback — making it ideal for long-lived CLI tools, automation, and server integrations.
keyring crate)GCLOUD_IDENTITY_TOKEN_PATHObtain application-default credentials (Required)
gcloud auth application-default login
Add to your Cargo.toml:
[dependencies]
gcloud-identity-token = "0.1"
use anyhow::Result;
use gcloud_identity_token::auth::get_token;
use gcloud_identity_token::config::load_creds;
#[tokio::main]
async fn main() -> Result<()> {
let creds = load_creds()?;
let token = get_token(&creds).await?;
println!("Access token: {}", token.access_token);
println!("ID token: {}", token.id_token);
println!("Expires at: {}", token.token_expiry);
Ok(())
}