| Crates.io | gauthenticator |
| lib.rs | gauthenticator |
| version | 0.2.3 |
| created_at | 2023-11-24 19:58:40.021391+00 |
| updated_at | 2024-12-06 03:50:33.793541+00 |
| description | Simple API for authenticating with google services Project homepage: https://github.com/isaacadams/bq-rs |
| homepage | https://github.com/isaacadams/bq-rs |
| repository | https://github.com/isaacadams/bq-rs |
| max_upload_size | |
| id | 1047550 |
| size | 30,624 |
There are three ways to load authentication credentials for google services.
// 1. load credentials from an environment variable
let authentication = gauthenticator::from_environment_variable("SOME_ENV_VAR");
// 2. load credentials from a file path
let authentication = gauthenticator::from_file("/path/to/credentials.json");
// 3. load credentials from your machine's environment using well known locations
let authentication = gauthenticator::from_env().authentication();
let Some(authentication) = authentication else {
panic!("failed to find credentials");
};
// log out the authentication details
log::debug!("{}", authentication.message());
// load project id from user input or from the service account file
let project_id = authentication.project_id().expect("project id is required");
// create the bearer token
let token = authentication.token(None)?;