From c80fb5855de3bb26c9d5bd8dd7ee0725ae79f236 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 28 Nov 2015 03:36:13 -0500 Subject: [PATCH] Add Google example --- examples/google.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/google.rs diff --git a/examples/google.rs b/examples/google.rs new file mode 100644 index 0000000..0e36642 --- /dev/null +++ b/examples/google.rs @@ -0,0 +1,19 @@ +extern crate inth_oauth2; + +use inth_oauth2::Client; + +fn main() { + let client = Client { + authorization_uri: String::from("https://accounts.google.com/o/oauth2/auth"), + client_id: String::from("143225766783-ip2d9qv6sdr37276t77luk6f7bhd6bj5.apps.googleusercontent.com"), + client_secret: String::from("3kZ5WomzHFlN2f_XbhkyPd3o"), + redirect_uri: Some(String::from("urn:ietf:wg:oauth:2.0:oob")), + }; + + let auth_uri = client.authorization_uri( + Some("https://www.googleapis.com/auth/userinfo.email"), + None + ).unwrap(); + + println!("{}", auth_uri); +}