auth-google-one-tap
Documentation / lib/components/AppLayout/auth-google-one-tap
displayGoogleOneTapLogin()
function displayGoogleOneTapLogin(client_id: string, options: object): Promise<boolean>;
Defined in: web-app/src/lib/components/AppLayout/auth-google-one-tap.js:51
Show Google One Tap menu and send JWT userinfo to callback.
The verifyIdToken function verifies the JWT signature, the aud claim, the exp claim, and the iss claim.
Error: If browser blocks due to closing with "FedCM get() rejects with NetworkError" then clear cookies and allow localhost in chrome://settings/content/federatedIdentityApi, or click lock icon in url bar and allow "Third Party Sign In"
Parameters
Parameter | Type | Description |
---|---|---|
|
| Google OAuth Client ID |
| { | |
|
| If true, the One Tap prompt will immediately return an ID token without user interaction when there is only one Google session. |
|
| ‐ |
|
| If true, the One Tap request will be canceled if the user clicks outside the prompt. If user clicks X it's always off until they click lock icon in url bar and allow "Third Party Sign In" |
|
| ‐ |
|
| If true, the browser will control user sign-in prompts and mediate the sign-in flow between your website and Google. |
Returns
Promise
<boolean
>
true if able to show menu
See
- Verify_JWT Verify Docs
- Google_One_Tap One Tap Docs
Author
Example
if (!user) {
var isOneTapShown = displayGoogleOneTapLogin(
PUBLIC_GOOGLE_CLIENT_ID, {
auto_select: true,
use_fedcm_for_prompt: true,
cancel_on_tap_outside: true,
callback_url: `/auth/google/callback`,
state_cookie_domain: PUBLIC_DOMAIN
})
if (!isOneTapShown)
console.log("OneTap error - use alternatives");
}
loadScript()
function loadScript(url: string): Promise<any>;
Defined in: web-app/src/lib/components/AppLayout/auth-google-one-tap.js:107
Loads a script from the given URL.
Parameters
Parameter | Type | Description |
---|---|---|
|
|
Returns
Promise
<any
>