Skip to main content

Module google

Module google 

Source
Expand description

Google sign-in in the browser, for desktop apps: OAuth 2.0 for installed apps with a loopback redirect and PKCE (S256). Not available on wasm.

  1. GoogleSignIn::start listens on 127.0.0.1 at a random port and builds the authorization URL.
  2. The app opens GoogleSignIn::authorization_url in the browser (or calls [open_browser] with the open-browser feature).
  3. GoogleSignIn::finish waits for the redirect, answers the browser with a “you can close this window” page, and exchanges the code for tokens.

The ID token then signs in to the cloud with crate::CloudClient::sign_in_with_google_id_token.

Structs§

GoogleDesktopConfig
A Google OAuth client of type “Desktop app”. Its secret is not confidential for installed apps, but it is still the caller’s to supply.
GoogleSignIn
A sign-in waiting for the browser.
GoogleTokens
Tokens from Google. id_token is what the cloud wants.
SignInCanceller
Cancels a pending sign-in from anywhere: GoogleSignIn::finish then fails with Error::Cancelled.

Constants§

DEFAULT_SIGN_IN_TIMEOUT
How long GoogleSignIn::finish waits for the user by default.
GOOGLE_AUTH_URL
GOOGLE_TOKEN_URL