#google #verification

google_auth_verifier

Small library to quickly verify tokens provided by google auth

4 releases

0.1.4 Jul 2, 2024
0.1.3 Jul 1, 2024
0.1.2 Jul 1, 2024
0.1.1 Jul 1, 2024
0.1.0 Jul 1, 2024

#654 in Authentication

Download history 353/week @ 2024-06-27 88/week @ 2024-07-04

134 downloads per month

MIT license

14KB
112 lines

Rust Google Authentication Library

A simple Rust library for verifying Google auth tokens.

Installation

Add this to your Cargo.toml:

[dependencies]
google-auth-verifier = "0.1.4"

Usage

use google_auth_verifier::AuthVerifierClient;

#[tokio::main]
async fn main() {
    // None for auth verifier options will use default options
    let mut auth_verifier_client = AuthVerifierClient::new(None);
    // verify_generic_token will work for both firebase and oauth tokens
    let res = auth_verifier_client.verify_generic_token("# insert key here").await;

    match res {
        Ok(token_info) => {
            println!("Token is valid: {:?}", token_info);
        },
        Err(e) => {
            eprintln!("Failed to verify token: {:?}", e);
        },
    }
}

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Acknowledgements

Dependencies

~7–19MB
~293K SLoC