Setup
1
Get a client ID
Go to the Google Cloud Console, create an OAuth 2.0 credential, copy the Client ID.2
How it works
- Google’s JS shows a sign-in prompt on your page
- User taps their Google account
- Google sends a
credential(JWT ID token) to your callback - theAuth verifies the JWT against Google’s JWKS (
https://www.googleapis.com/oauth2/v3/certs) - Validates audience, issuer, expiry, and CSRF token
- Finds the user by email (or creates one when
autoCreateUseris 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 ag_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.
Related
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.