| Crates.io | google-signin-client |
| lib.rs | google-signin-client |
| version | 0.2.0 |
| created_at | 2023-12-14 09:54:56.79984+00 |
| updated_at | 2024-05-20 04:40:28.55936+00 |
| description | Client API for Google sign in client |
| homepage | |
| repository | https://git.panter.ch/open-source/google-signin-client |
| max_upload_size | |
| id | 1069270 |
| size | 29,656 |
It is a shallow wrapper over some features of the google javascript sign in library
Include the javascript library from google into your html file:
<head>
<script src="https://accounts.google.com/gsi/client"></script>
</head>
Now call the initialization on the API:
let mut configuration = IdConfiguration::new(client_id);
configuration.set_callback(Box::new( move | response| {
let jwt_token = response.credential();
// handle JWT Token
}));
initialize(configuration);
Initiating the login prompt by calling the API:
spawn_local( async move {
let result = prompt_async().await;
if result != PromptResult::Dismissed(DismissedReason::CredentialReturned) {
// handle error condition (in case of success, the callback configured before is called)
}
});