Crates.io | gouth |
lib.rs | gouth |
version | 0.2.1 |
source | src |
created_at | 2020-05-04 07:32:06.254845 |
updated_at | 2021-04-19 01:48:44.411822 |
description | This library provides auto-renewed tokens for GCP service authentication. |
homepage | |
repository | https://github.com/mechiru/gouth |
max_upload_size | |
id | 237338 |
size | 28,039 |
This library provides auto-renewed tokens for GCP service authentication.
Authentication flow | Status |
---|---|
API key | Not supported / No plans to support |
OAuth 2.0 client | Supported |
Environment-provided service account | Supported |
Service account key | Supported |
https://www.googleapis.com/auth/cloud-platform
GOOGLE_APPLICATION_CREDENTIALS
environment variable.// simple:
// gouth = { version = "x.x.x" }
let token = gouth::Token::new().unwrap();
println!("authorization: {}", token.header_value().unwrap());
// with tonic:
// gouth = { path = "x.x.x", features = ["tonic-intercept"] }
let mut service = PublisherClient::with_interceptor(channel, gouth::tonic::interceptor());
service.list_topics(...);
scope:
use gouth::Builder;
let token = Builder::new()
.scopes(&["https://www.googleapis.com/auth/bigquery"])
.build()
.unwrap();
println!("authorization: {}", token.header_value().unwrap());
json:
use gouth::Builder;
let token = Builder::new().json("credentials-data").build().unwrap();
println!("authorization: {}", token.header_value().unwrap());
file:
use gouth::Builder;
let token = Builder::new().file("credentials-path").build().unwrap();
println!("authorization: {}", token.header_value().unwrap());
Licensed under MIT license.