Single-tap sign-in
Offer fast Google authentication with Google's One Tap prompt.
Better Auth · Const
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.
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.
oneTap({ clientId: string })| Name | Type | Description |
|---|---|---|
clientId | string | Google OAuth client identifier used by the One Tap integration. |
options | One Tap options | Client configuration can include UX mode, context, and optional button settings. |
A Better Auth plugin configuration used to enable Google One Tap on the server.
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.
Offer fast Google authentication with Google's One Tap prompt.
Use a Google sign-in control instead of an automatic prompt.
Choose navigation behavior appropriate to the application flow.
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.
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.
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.
oneTapClientauthClient.oneTapbetterAuthGoogle social provider