5 releases

0.2.0 Jul 7, 2024
0.1.3 Mar 18, 2024
0.1.2 Mar 16, 2024
0.1.1 Mar 16, 2024
0.1.0 Mar 16, 2024

#805 in Authentication

MIT license

6KB
64 lines

googol

TLDR

A library to reduce the boilerplate needed to call Google APIs.

Example usage

const SCOPES: &'static [&'static str] = &["https://www.googleapis.com/auth/firebase.messaging"];

#[cfg(debug_assertions)]
static GCP_AUTHENTICATION_CLIENT: googol::Client =
    googol::Client::from_file("credentials.json", SCOPES);
#[cfg(not(debug_assertions))]
static GCP_AUTHENTICATION_CLIENT: googol::Client = googol::Client::from_environment(SCOPES);

async fn get_auth_token() -> Result<Token, Error> {
    GCP_AUTHENTICATION_CLIENT
        .get_token()
        .await
        .or(Err(Error::AuthError))
}

Dependencies

~19–31MB
~580K SLoC