Request token in Google example

This commit is contained in:
Curtis McEnroe 2015-12-24 01:11:14 -05:00
parent 03b178c89c
commit cfa53d8b35
1 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,7 @@
extern crate inth_oauth2; extern crate inth_oauth2;
use std::io;
use inth_oauth2::client::Client; use inth_oauth2::client::Client;
use inth_oauth2::provider::Google; use inth_oauth2::provider::Google;
@ -14,4 +16,10 @@ fn main() {
let auth_uri = client.auth_uri(Some("https://www.googleapis.com/auth/userinfo.email"), None) let auth_uri = client.auth_uri(Some("https://www.googleapis.com/auth/userinfo.email"), None)
.unwrap(); .unwrap();
println!("{}", auth_uri); println!("{}", auth_uri);
let mut code = String::new();
io::stdin().read_line(&mut code).unwrap();
let token = client.request_token(code.trim()).unwrap();
println!("{:?}", token);
} }