inth-oauth2/examples/github.rs

25 lines
551 B
Rust
Raw Normal View History

2015-11-28 17:52:18 +00:00
extern crate inth_oauth2;
2015-11-28 20:21:16 +00:00
use std::io;
2015-11-28 17:52:18 +00:00
use inth_oauth2::Client;
fn main() {
let client = Client::github(
2015-11-28 21:56:13 +00:00
Default::default(),
2015-11-28 17:52:18 +00:00
"01774654cd9a6051e478",
"9f14d16d95d605e715ec1a9aecec220d2565fd5c",
Some("https://cmcenroe.me/oauth2-paste")
);
let auth_uri = client.auth_uri(Some("user"), None).unwrap();
println!("{}", auth_uri);
2015-11-28 20:21:16 +00:00
let mut code = String::new();
io::stdin().read_line(&mut code).unwrap();
2015-11-28 21:56:13 +00:00
let token = client.request_token(code.trim()).unwrap();
2015-11-28 20:21:16 +00:00
println!("{:?}", token);
2015-11-28 17:52:18 +00:00
}