Crate google_jwt_auth
source ·Expand description
Crate google-jwt-auth
This crate provides the functionality to create authentication tokens for google requests.
Two easy steps to obtain a token:
- Create an
AuthConfig
instance withAuthConfig::build()
- Generate a token with
AuthConfig::generate_auth_token()
Example
use google_jwt_auth::AuthConfig;
use google_jwt_auth::usage::Usage;
// Step one: Create AuthConfig
let client_json = std::fs::read_to_string("tests/test-client.json").unwrap();
let usage = Usage::CloudVision;
let config = AuthConfig::build(&client_json, &usage).unwrap();
// Step two: Generate token
let lifetime = 3600_i64;
let token_response = config.generate_auth_token(lifetime);
After awaiting the token_response
the result can be obtained.
Modules
- This module contains all error types and meanings.
- This module contains all types of usages and their description.
Structs
- This struct contains all necessary information to request an authentication token from google. This structure is intended to be reused by the client for several token generation requests.
Type Aliases
- This typing is used to have easy access to the library errors.