Complete examples

This commit is contained in:
Curtis McEnroe 2015-11-28 15:21:16 -05:00
parent 10823a3d81
commit cc8645da8f
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,7 @@
extern crate hyper;
extern crate inth_oauth2; extern crate inth_oauth2;
use std::io;
use inth_oauth2::Client; use inth_oauth2::Client;
fn main() { fn main() {
@ -12,4 +14,11 @@ fn main() {
let auth_uri = client.auth_uri(Some("user"), None).unwrap(); let auth_uri = client.auth_uri(Some("user"), None).unwrap();
println!("{}", auth_uri); println!("{}", auth_uri);
let mut code = String::new();
io::stdin().read_line(&mut code).unwrap();
let token = client.request_token(hyper::Client::new(), code.trim()).unwrap();
println!("{:?}", token);
} }

View File

@ -21,5 +21,7 @@ fn main() {
let mut code = String::new(); let mut code = String::new();
io::stdin().read_line(&mut code).unwrap(); io::stdin().read_line(&mut code).unwrap();
client.request_access_token(hyper::Client::new(), &code).unwrap(); let token = client.request_token(hyper::Client::new(), code.trim()).unwrap();
println!("{:?}", token);
} }