update bearer documentation
This commit is contained in:
parent
613c8e5d59
commit
5627530f9c
21
src/lib.rs
21
src/lib.rs
|
@ -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`.
|
||||
|
|
Loading…
Reference in New Issue