> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google One Tap

> Implement Google One Tap authentication using the Stytch Next.js SDK

`oauth.googleOneTap.start()` will show the Google One Tap prompt in the top right corner of the user's browser. An `organization_id` is required to specify which organization the user is trying to access. If the organization that the user is trying to access is not yet known, use the `oauth.googleOneTap.discovery.start()` method instead.

If the end user clicks to sign in with Google One Tap, Stytch will verify the response and redirect to the `login_redirect_url` or `signup_redirect_url` provided, or the default redirect URLs if none are specified. A PKCE `code_verifier` will also be generated and stored in local storage on the device (See the [PKCE OAuth guide](multi-tenant-auth/authentication/oauth/adding-pkce) for details). If your application is configured to use a custom subdomain with Stytch, it will be used automatically.

Once the user is successfully redirected, you can collect the Stytch OAuth token from the URL query parameters, and call the [OAuth Authenticate](./authenticate) method to complete the authentication flow.

<Warning>
  Google One Tap does **not** return access tokens. If you wish to retrieve the user's access token, use the [Start OAuth Flow](./start) method instead.
</Warning>

### Method parameters

<ParamField path="organization_id" type="string" required>
  The id of the Organization to start the OAuth flow for.
</ParamField>

<ParamField path="login_redirect_url" type="string" required>
  The URL Stytch redirects to after the OAuth flow is completed for a Member that already exists. This URL should be a route in your application which will run oauth.authenticate (see below) and finish the login.

  The URL must be configured as a Login URL in the [Redirect URL page](https://stytch.com/dashboard/redirect-urls). If the field is not specified, the default Login URL will be used.
</ParamField>

<ParamField path="signup_redirect_url" type="string" required>
  The URL Stytch redirects to after the OAuth flow is completed for a Member that does not yet exist. This URL should be a route in your application which will run oauth.authenticate (see below) and finish the login.

  The URL must be configured as a Signup URL in the [Redirect URL page](https://stytch.com/dashboard/redirect-urls). If the field is not specified, the default Signup URL will be used.
</ParamField>

<ParamField path="cancel_on_tap_outside" type="boolean" default="true">
  Whether the Google One Tap prompt is automatically dismissed when the user taps outside of it. Defaults to `true`.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Whether the Google One Tap prompt was successfully started.
</ResponseField>

<ResponseField name="reason" type="string">
  If `success` is `false`, the reason why the Google One Tap prompt failed to start.
</ResponseField>

<Panel>
  <RequestExample>
    ```jsx theme={null}
    import { useEffect } from 'react';
    import { useStytchB2BClient } from '@stytch/nextjs/b2b';

    export const GoogleOneTapLogin = () => {
      const stytch = useStytchB2BClient();

      useEffect(() => {
        const result = stytch.oauth.googleOneTap.start({
          organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931',
          login_redirect_url: 'https://example.com/authenticate',
          signup_redirect_url: 'https://example.com/authenticate',
        });

        if (!result.success) {
          console.error('Google One Tap failed to start:', result.reason);
        }
      }, [stytch]);

      return <div>Loading Google One Tap...</div>;
    };
    ```
  </RequestExample>
</Panel>
