Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Better Auth · Const

oneTap

The oneTap constant is Better Auth’s server plugin for Google One Tap sign-in. Configure it in betterAuth with a Google client ID and pair it with the client-side oneTapClient plugin.

How it works

oneTap configures Better Auth's server-side Google One Tap integration. It works with the client-side oneTapClient plugin, which supplies the client ID and lets the application invoke the One Tap flow or render a Google sign-in button.

Syntax

oneTap({ clientId: string })

Parameters

NameTypeDescription
clientIdstringGoogle OAuth client identifier used by the One Tap integration.
optionsOne Tap optionsClient configuration can include UX mode, context, and optional button settings.

Returns

A Better Auth plugin configuration used to enable Google One Tap on the server.

Key points

  • This plugin provides Google One Tap authentication so users can begin sign-in with one interaction.
  • It packages the server and browser integration instead of requiring separate One Tap plumbing.
  • Supply the Google OAuth client ID when configuring the server plugin.
  • Start the One Tap prompt by invoking oneTap on the configured authentication client.
  • The UX mode can use either a popup or a redirect flow.

Common mistakes

  • The Google Cloud OAuth client must list every authorized JavaScript origin, such as the local development and production application URLs.

Example: Configure the One Tap server plugin

import { betterAuth } from "better-auth";
import { oneTap } from "better-auth/plugins";

export const auth = betterAuth({
  plugins: [
    oneTap({
      clientId: process.env.GOOGLE_CLIENT_ID as string,
    }),
  ],
});

Configure the server plugin with the Google OAuth client ID, then add the matching client plugin and call authClient.oneTap() in the browser.

When to use it

Single-tap sign-in

Offer fast Google authentication with Google's One Tap prompt.

Button-based Google login

Use a Google sign-in control instead of an automatic prompt.

Popup or redirect authentication

Choose navigation behavior appropriate to the application flow.

Interview questions

QWhat does the oneTap plugin do?

oneTap is the server plugin that integrates Better Auth with Google's One Tap API. Configure it in betterAuth with the Google clientId, then pair it with oneTapClient on the client.

Follow-up: What browser-side method starts the flow? Call authClient.oneTap(); the client plugin also supports a button configuration for rendering a Sign In with Google button.

QWhat configuration is required?

The current stable documentation requires a clientId for oneTap. The value should correspond to the Google OAuth web client configured for the application.

Follow-up: Which Google Cloud setting is easy to overlook? Authorized JavaScript origins must include the application's origins, including localhost when developing.

QWhich flow options are available?

The client flow supports popup and redirect UX modes, with popup as the default. Its context can be signin, signup, or use, with signin as the default.

Follow-up: How can an application avoid the automatic prompt? Pass button options to authClient.oneTap() to render a Google sign-in button instead.

  • oneTapClient
  • authClient.oneTap
  • betterAuth
  • Google social provider

Source: One Tap. Checked 2026-10-15.