From cfa53d8b3519f4097b02bb671bc10f31bd0d4552 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 24 Dec 2015 01:11:14 -0500 Subject: [PATCH] Request token in Google example --- examples/google.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/google.rs b/examples/google.rs index 1637d8f..18a62a4 100644 --- a/examples/google.rs +++ b/examples/google.rs @@ -1,5 +1,7 @@ extern crate inth_oauth2; +use std::io; + use inth_oauth2::client::Client; 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) .unwrap(); 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); }