Skip to main content
Google One-tap lets users sign in with a single tap using their Google account. The frontend shows Google’s prompt, the backend verifies the ID token via Google’s JWKS. No Google SDK needed server-side.

Setup

1

Get a client ID

Go to the Google Cloud Console, create an OAuth 2.0 credential, copy the Client ID.
2

Configure the plugin

oneTap() issues a session on success, so auth.session must be configured. Without it the plugin throws on startup.
3

Add Google’s script to your frontend

How it works

  1. Google’s JS shows a sign-in prompt on your page
  2. User taps their Google account
  3. Google sends a credential (JWT ID token) to your callback
  4. theAuth verifies the JWT against Google’s JWKS (https://www.googleapis.com/oauth2/v3/certs)
  5. Validates audience, issuer, expiry, and CSRF token
  6. Finds the user by email (or creates one when autoCreateUser is true) and returns a session as JSON: { user: { id, email }, session: { token, expiresAt } }. The plugin does not set a cookie or redirect

CSRF protection

Google sends a g_csrf_token cookie with the request. theAuth validates that the cookie value matches the g_csrf_token field in the POST body.

Config

An existing account is matched by email (case-insensitive) only when Google reports email_verified: true and the local address is verified. Otherwise the callback answers 409 with code ACCOUNT_EXISTS and no session. New users are stored as verified only when Google said so.

Endpoint

Google One-tap requires HTTPS in production. It works on localhost for development.
The One-tap handler only matches the exact path /auth/one-tap/callback. When theAuth is mounted under an adapter prefix such as /api/theauth, the request path includes the prefix and the handler responds with Unexpected routing error (500). Serve theAuth with no path prefix for One-tap, or route the callback to it at the root path.

Google

Full Google OAuth 2.0 flow with additional scopes.

OAuth overview

Generic OAuth 2.0 setup and account linking behavior.

Magic link

Another low-friction sign-in option without a password.

Authentication overview

All sign-in methods available in theAuth.
Last modified on October 19, 2026