1extern crate reqwest;
2extern crate inth_oauth2;
3
4use std::io;
5
6use inth_oauth2::Client;
7use inth_oauth2::provider::GitHub;
8
9fn main() {
10 let http_client = reqwest::Client::new();
11
12 let client = Client::new(
13 GitHub,
14 String::from("01774654cd9a6051e478"),
15 String::from("9f14d16d95d605e715ec1a9aecec220d2565fd5c"),
16 Some(String::from("https://cmcenroe.me/oauth2-paste/")),
17 );
18
19 let auth_uri = client.auth_uri(Some("user"), None);
20 println!("{}", auth_uri);
21
22 let mut code = String::new();
23 io::stdin().read_line(&mut code).unwrap();
24
25 let token = client.request_token(&http_client, code.trim()).unwrap();
26 println!("{:?}", token);
27}