imgur/
imgur.rs

1extern crate reqwest;
2extern crate inth_oauth2;
3
4use std::io;
5
6use inth_oauth2::Client;
7use inth_oauth2::provider::Imgur;
8
9fn main() {
10    let http_client = reqwest::Client::new();
11
12    let client = Client::new(
13        Imgur,
14        String::from("505c8ca804230e0"),
15        String::from("c898d8cf28404102752b2119a3a1c6aab49899c8"),
16        Some(String::from("https://cmcenroe.me/oauth2-paste/")),
17    );
18
19    let auth_uri = client.auth_uri(None, 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
28    let token = client.refresh_token(&http_client, token, None).unwrap();
29    println!("{:?}", token);
30}