2 个版本
0.2.2 | 2024 年 5 月 27 日 |
---|---|
0.2.1 | 2024 年 5 月 25 日 |
0.1.6 |
|
0.1.5 |
|
0.1.2 |
|
1669 在 网页开发 中
每月 50 次下载
用于 bq-rs
30KB
569 行
使用方法
有三种方式可以加载 Google 服务的认证凭据。
// 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)?;
依赖
~11–20MB
~385K SLoC