gcp_auth 0.12.6

Google cloud platform (GCP) authentication using default and custom service accounts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    tracing::subscriber::set_global_default(
        tracing_subscriber::FmtSubscriber::builder()
            .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
            .finish(),
    )
    .unwrap();

    let token_provider = gcp_auth::provider().await?;
    let _token = token_provider
        .token(&["https://www.googleapis.com/auth/cloud-platform"])
        .await?;
    Ok(())
}