Google Sign-In for Rust

google-signin on crates.io google-signin on docs.rs

Rust API bindings for Google Sign-in.
See authenticating with a backend server.

Usage

Put this in your Cargo.toml:

toml [dependencies] google-signin = "0.2.0"

And this in your crate root:

rust extern crate google_signin;

And then you can verify a google JSON web token

```rust use googlesignin; let mut client = googlesignin::Client::new(); client.audiences.push(YOURCLIENTID); // recommended client.hosteddomains.push(YOURHOSTED_DOMAIN); // optional

// Let the crate handle everything for you let idinfo = client.verify(&data.token).expect("Expected token to be valid"); println!("Success! Signed-in as {}", idinfo.sub);

// Inspect the ID before verifying it let idinfo = client.getunsafe(&data.token).expect("Expected token to exist"); let ok = idinfo.verify(&client).isok(); println!("Ok: {}, Info: {:?}", ok, id_info); ```