update bearer documentation

This commit is contained in:
edelangh 2018-10-15 23:54:36 +02:00
parent 613c8e5d59
commit 5627530f9c
1 changed files with 21 additions and 0 deletions

View File

@ -103,6 +103,27 @@
//! # }
//! ```
//!
//! ### Using bearer access tokens
//!
//! Bearer tokens can be converted to Hyper headers.
//!
//! ```no_run
//! # extern crate inth_oauth2;
//! # extern crate reqwest;
//! # use inth_oauth2::Client;
//! # use inth_oauth2::provider::google::Installed;
//! use inth_oauth2::Token;
//!
//! # fn main() {
//! # let oauth_client = Client::new(Installed, String::new(), String::new(), None);
//! # let http = reqwest::Client::new();
//! # let token = oauth_client.request_token(&http, "").unwrap();
//! let request = http.get("https://example.com/resource")
//! .bearer_auth(token.access_token())
//! .build();
//! # }
//! ```
//!
//! ### Persisting tokens
//!
//! All token types implement `Serialize` and `Deserialize` from `serde`.