Google-Oauth
Description
Google-Oauth
is a server-side verification library for Google oauth2.
Google-Oauth
can help you to verify id_token
which is generated from Google.
This lib provides blocking
and async
API for your convince. If you are using async
, note that
Google-Oauth
doesn't provide any async runtime (like tokio
or async-std
).
Simple Usage
Suppose you've got an id_token
from Google. id_token
is a JWT which looks like eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2OTY5YWVjMzdhNzc4MGYxODgwNz...
.
And you need to know your client_id
which you generated in Google Admin Console. The client_id
looks like xxxxx.apps.googleusercontent.com
.
Now, add this in your Cargo.toml
:
[]
= "1"
Then,
use Client;
AsyncClient
You can use AsyncClient
with an async runtime.
use AsyncClient;
// or #[async_std::main]
// or #[actix_web::main]
async