Social sign-in
Users authenticate with existing LinkedIn accounts instead of creating a separate password.
Better Auth · Const
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".
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.
socialProviders: { linkedin: { clientId: string, clientSecret: string } }
await authClient.signIn.social({ provider: "linkedin" })| Name | Type | Description |
|---|---|---|
provider | string | The provider to authenticate with; set this to linkedin. |
The page shows the asynchronous sign-in call but does not specify a return type or response shape.
socialProviders option.signIn.social function.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.
Users authenticate with existing LinkedIn accounts instead of creating a separate password.
A web application delegates identity verification and consent to LinkedIn.
An application needs a built-in Better Auth provider rather than manually defining OAuth endpoints.
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.
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.
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.
socialProviderssignIn.socialmapProfileToUserHandling Providers Without EmailLinkedIn Developer Portal