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

Better Auth · Module

signIn.social

signIn.social starts client-side OAuth sign-in for a configured social provider. Pass the provider ID and optionally a redirect URL or extra authorization parameters.

How it works

The client method receives a social provider identifier and can include a post-authentication callback URL. Better Auth then begins the provider’s OAuth flow; the provider must already be configured in the auth instance.

Syntax

authClient.signIn.social({ provider, callbackURL?, additionalParams? })

Parameters

NameTypeDescription
providerstringThe configured social provider identifier, for example github, google, or apple.
callbackURLstringURL to redirect to after authentication; the documented default is /.
additionalParamsRecord<string, string>Additional query parameters sent to the provider authorization endpoint.

Returns

A promise for the sign-in operation; the resulting response contains the authentication result or error.

Key points

  • Use signIn.social for client-side social authentication.
  • The method accepts a single options object rather than a positional provider argument.
  • Set provider to the configured provider identifier, such as github, google, or apple.
  • Use callbackURL to control the destination after the provider completes authentication.
  • Use additionalParams when the provider needs extra authorization query parameters.

Common mistakes

  • Configure the selected provider in the auth instance before calling the method.
  • The callback URL controls where the user is redirected after provider authentication.

Example: Sign in with a social provider

import { createAuthClient } from "better-auth/client";

const authClient = createAuthClient();

await authClient.signIn.social({
  provider: "github",
  callbackURL: "/dashboard",
});

Starts social authentication with GitHub and requests a redirect to the dashboard after authentication.

When to use it

Social account login

Offer GitHub, Google, Apple, or another configured OAuth provider as a login option.

Post-login routing

Send users to a dashboard or onboarding route after successful authentication.

Customized OAuth authorization

Pass provider-specific authorization hints or consent parameters.

Interview questions

QHow do you start social sign-in from the client?

Call authClient.signIn.social with an object containing the provider ID, such as github or google. The provider must be configured under the auth instance’s socialProviders option.

Follow-up: How would server-side code initiate the same flow? Use auth.api.signInSocial and place the provider in its request body.

QHow do you choose the post-login destination?

Pass callbackURL in the options object to specify the destination after successful provider authentication. If omitted, the documented default is /.

Follow-up: How can provider-specific authorization parameters be forwarded? Add them through additionalParams on the social sign-in call.

QWhat does the provider parameter represent?

The provider value identifies which configured OAuth provider should handle authentication. Examples in the documentation include GitHub, Google, and Apple.

Follow-up: What must be configured before this call can work? Supply the provider credentials and configuration in socialProviders on the auth setup.

  • socialProviders
  • authClient
  • auth.api.signInSocial
  • linkSocial
  • callbackURL
  • additionalParams

Source: Basic Usage | Better Auth. Checked 2026-10-15.