Crate gauthz [−] [src]
An interface for fetching Google API tokens targeting Server to Server applications
examples
// gauthz interfaces extern crate gauthz; // tokio async io extern crate tokio_core; // futures combinators extern crate futures; use futures::Stream; use gauthz::{Credentials, Scope, Tokens}; use tokio_core::reactor::Core; use std::thread::sleep_ms; fn main() { let mut core = Core::new().unwrap(); let tokens = Tokens::new( &core.handle(), Credentials::default().unwrap(), vec![Scope::CloudPlatform], ); // warning: this token dispenser never ends! let dispenser = tokens.stream().for_each(|token| { println!("{}", token.value()); Ok(sleep_ms(2000)) // do something interesting }); println!("{:#?}", core.run(dispenser)) }
Cargo features
This crate has one Cargo feature, tls
, which adds HTTPS support via the Tokens::new
constructor. This feature is enabled by default.
Reexports
pub use error::Error; |
pub use error::Result; |
Modules
error |
error types |
Structs
AccessToken |
An access token can be used to authenticate google api requests |
Credentials |
Authentication credential information generated from google api console |
Tokens |
An interface for generating access tokens to authenticate google api requests |
Enums
Scope |
API Scope values |
Type Definitions
Future |
A |
Stream |
A |