From 0e9bbb80d97929a5d6456a09ae67a57f722ee11f Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 24 Dec 2015 14:44:06 -0500 Subject: [PATCH] Request token in GitHub example --- examples/github.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/github.rs b/examples/github.rs index 60de494..4ab2000 100644 --- a/examples/github.rs +++ b/examples/github.rs @@ -1,5 +1,7 @@ extern crate inth_oauth2; +use std::io; + use inth_oauth2::client::Client; use inth_oauth2::provider::GitHub; @@ -13,4 +15,10 @@ fn main() { let auth_uri = client.auth_uri(Some("user"), 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); }