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

Better Auth · Const

linkedin

Better Auth's LinkedIn provider enables OAuth/OpenID Connect sign-in using LinkedIn application credentials. Configure it under socialProviders.linkedin, then call signIn.social with provider: "linkedin".

How it works

The LinkedIn integration is a built-in social provider. Register it under socialProviders with its client credentials, then call signIn.social using the linkedin provider identifier to begin authentication.

Syntax

socialProviders: { linkedin: { clientId: string, clientSecret: string } }
await authClient.signIn.social({ provider: "linkedin" })

Parameters

NameTypeDescription
providerstringThe provider to authenticate with; set this to linkedin.

Returns

The page shows the asynchronous sign-in call but does not specify a return type or response shape.

Key points

  • The integration requires both a LinkedIn client ID and client secret.
  • Obtain the credentials from LinkedIn's Developer Portal rather than generating them in Better Auth.
  • Enable LinkedIn's OpenID Connect sign-in product for the application.
  • Add the provider configuration to the auth instance's socialProviders option.
  • Start the browser sign-in flow through the client's signIn.social function.
  • The sign-in method receives an options object rather than a positional provider argument.

Common mistakes

  • The local development redirect URL must use the documented callback path.
  • Changing the authentication route base path requires changing LinkedIn's configured redirect URL.

Example: Configure and sign in with LinkedIn

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

export const auth = betterAuth({
  socialProviders: {
    linkedin: {
      clientId: process.env.LINKEDIN_CLIENT_ID as string,
      clientSecret: process.env.LINKEDIN_CLIENT_SECRET as string,
    },
  },
});

const authClient = createAuthClient();
await authClient.signIn.social({ provider: "linkedin" });

Configure LinkedIn with credentials, then start the provider flow through the client.

When to use it

Social sign-in

Users authenticate with existing LinkedIn accounts instead of creating a separate password.

OpenID Connect authentication

A web application delegates identity verification and consent to LinkedIn.

Provider-specific integration

An application needs a built-in Better Auth provider rather than manually defining OAuth endpoints.

Interview questions

QHow do you configure and invoke LinkedIn sign-in?

Register linkedin inside the auth instance's socialProviders option and supply clientId and clientSecret. The client then starts authentication with authClient.signIn.social({ provider: "linkedin" }).

Follow-up: What configuration must be synchronized outside the application? The LinkedIn Developer Portal must contain the matching callback URL, and the required Sign In with LinkedIn using OpenID Connect product must be enabled.

QWhich provider identifier does the sign-in call use?

The provider identifier passed to signIn.social is linkedin. The provider configuration also uses the linkedin property under socialProviders, linking the client call to the registered credentials.

Follow-up: What happens if the route base path changes? Update the redirect URL in LinkedIn's portal to reflect the new authentication callback path.

QWhat profile-data limitation should an implementation handle?

LinkedIn may omit email and email_verified when the member has no confirmed email. The documentation points to mapProfileToUser fallback handling for providers without email.

Follow-up: What should profile mapping account for? It should create or identify the user without requiring an email claim when LinkedIn does not provide one.

  • socialProviders
  • signIn.social
  • mapProfileToUser
  • Handling Providers Without Email
  • LinkedIn Developer Portal

Source: LinkedIn Provider. Checked 2026-10-15.