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

Better Auth · Const

google

google is Better Auth’s provider identifier for Google social authentication. Use it in the provider configuration and in social sign-in requests.

How it works

google is the provider identifier Better Auth uses to select the Google OAuth configuration. Register the provider under socialProviders.google with its client credentials, then pass provider: "google" to the social sign-in API.

Syntax

provider: "google"

Parameters

NameTypeDescription
providerstringProvider identifier selecting Google; set this to google.

Returns

A social sign-in operation initiated for the configured Google provider.

Key points

  • Register Google beneath socialProviders.google and provide both OAuth credentials.
  • Start the browser-based Google flow with the client's signIn.social method.
  • The Google client ID is the OAuth identifier issued by Google for the application.
  • Google may issue different client IDs for web, Android, or iOS platforms within one project.

Common mistakes

  • The sign-in request must use the exact lowercase provider identifier google.
  • The Google OAuth client must allow Better Auth's callback URL; use the documented local callback during development and your application domain in production.

Example: Configure Google authentication

import { betterAuth } from "better-auth";

export const auth = betterAuth({
  socialProviders: {
    google: {
      clientId: process.env.GOOGLE_CLIENT_ID as string,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
    },
  },
});

Configure Google with OAuth credentials, then use the provider identifier google when starting social sign-in.

When to use it

Sign users in with Google through a redirect

OAuth browser flow

Accept Google ID tokens from multiple application clients

Multi-platform token validation

Use separate callback registrations for local and production environments

Environment-specific deployment

Interview questions

QWhat does the google identifier select?

google identifies the Google social-provider configuration in Better Auth. Configure credentials under socialProviders.google, then pass provider: "google" to signIn.social.

Follow-up: How would you support several Google client IDs? The documentation says to pass an array to clientId when accepting ID tokens issued for multiple platforms.

QWhat configuration is required for Google sign-in?

The provider configuration requires the Google OAuth clientId and clientSecret. These values come from a Google Cloud OAuth client, and the callback URI must also be registered there.

Follow-up: What must differ between local and production setup? Register the local callback for development and an application-domain callback for production.

QHow is Google sign-in initiated?

Client-side sign-in uses signIn.social with a request containing provider: "google". Better Auth uses that identifier to route the request to the Google provider.

Follow-up: Can sign-in use a token instead of a redirect? Yes; the Google documentation also describes passing an ID token through signIn.social.

  • socialProviders.google
  • signIn.social
  • clientId
  • clientSecret
  • redirectURI

Source: Google. Checked 2026-10-15.