1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! "Sign in with Google", all batteries included: a button for every
//! platform and the callback behind it.
//!
//! ```ignore
//! // Anywhere in a screen:
//! GoogleSignIn { on_signed_in: move |signed_in: GoogleSignedIn| { .. } }
//! ```
//!
//! ```ignore
//! // Once, in `main`, before the layers (so the session wraps it):
//! let router = dioxus::server::router(App)
//! .merge(g3_auth::google::google_router::<AppUser, Client, _>(
//! GoogleConfig::new("/home", "/signin/settings"),
//! MyAccounts,
//! ))
//! .layer(..);
//! ```
//!
//! The client id is the **web** OAuth client's, public, and read from the
//! `GOOGLE_OAUTH_CLIENT_ID` environment variable: at build time by the
//! client (see [`client_id`]) and at run time by the server. Android needs an
//! Android OAuth client for the app's package and signing key in the same
//! Google Cloud project, or the system flow returns no token.
use ;
pub use ;
pub use ;
/// Where Google, and the Android flow, post the signed ID token. Public: the
/// guard lets it through because the request is how a visitor becomes
/// signed in.
pub const GOOGLE_CALLBACK_PATH: &str = "/api/v1/google_signin_callback";
/// The form body Google (and the native flow) posts to
/// [`GOOGLE_CALLBACK_PATH`].
/// What a native sign-in answers: where the server would have redirected the
/// browser. A web sign-in never sees this, the browser follows the redirect.
/// The Google OAuth web client id, if one is configured. Compiled into the
/// client (`option_env!`, so it has to be in the environment of `dx build`,
/// not just a `.env` file), read from the environment at run time on the
/// server.