#jwt #google #verify #json #web #client #header

google-jwt-verify

A client to verify Google JSON web tokens

3 releases (breaking)

0.3.0 Dec 4, 2020
0.2.0 Mar 6, 2020
0.1.0 May 18, 2018

#40 in #verify

Download history 13/week @ 2023-12-25 29/week @ 2024-02-12 14/week @ 2024-02-19 25/week @ 2024-02-26 34/week @ 2024-03-04 100/week @ 2024-03-11 24/week @ 2024-03-18 17/week @ 2024-03-25 81/week @ 2024-04-01

235 downloads per month

MIT/Apache

25KB
621 lines

Google JSON Web Token Verify

Build Status crates.io documentation

This can be used to verify Google JWT tokens. Google's public keys are automatically fetched and cached according to the returned Cache-Control headers. Most requests to verify a token through this library will not wait for an HTTP request

For more info: https://developers.google.com/identity/sign-in/web/backend-auth

Quick Start

 //If you don't have a client id, get one from here: https://console.developers.google.com/
 let client_id = "37772117408-qjqo9hca513pdcunumt7gk08ii6te8is.apps.googleusercontent.com";
 let token = "...";// Obtain a signed token from Google
 let client = Client::new(&client_id);
 let id_token = client.verify_id_token(&token)?;
 
 //use the token to obtain information about the verified user
 let user_id = id_token.get_claims().get_subject();
 let email = id_token.get_payload().get_email();
 let name = id_token.get_payload().get_name();

Dependencies

~6–11MB
~246K SLoC