diff --git a/demo/nextjs/lib/auth.ts b/demo/nextjs/lib/auth.ts index 12db8b4a..17f4fd68 100644 --- a/demo/nextjs/lib/auth.ts +++ b/demo/nextjs/lib/auth.ts @@ -38,6 +38,11 @@ export const auth = betterAuth({ }, sendOnSignUp: true, }, + account: { + accountLinking: { + trustedProviders: ["google", "github"], + }, + }, emailAndPassword: { enabled: true, async sendResetPassword(user, url) { diff --git a/docs/content/docs/concepts/users-accounts.mdx b/docs/content/docs/concepts/users-accounts.mdx index 367196fa..e302c81f 100644 --- a/docs/content/docs/concepts/users-accounts.mdx +++ b/docs/content/docs/concepts/users-accounts.mdx @@ -122,23 +122,13 @@ The account table stores the authentication data of the user. The account table ### Account linking -Account linking allows users to connect multiple authentication methods to a single account. Better Auth supports linking social sign-on or OAuth providers to an existing account if the provider returns a verified email. If the email isn't verified, the account can't be linked. - -```ts -const auth = new BetterAuth({ - account: { - accountLinking: { - enabled: false, - } - }, -}); -``` +Account linking allows users to connect multiple authentication methods to a single account. Better Auth supports linking social sign-on or OAuth providers to an existing account if the provider returns a verified email. You can also specify a list of trusted providers. If a user signs in using a trusted provider, the account is linked, even if the email verification status is not provided. If account linking is disabled, accounts cannot be linked, regardless of the provider or email verification. -```ts +```ts title="auth.ts" const auth = new BetterAuth({ account: { accountLinking: { diff --git a/packages/better-auth/src/social-providers/google.ts b/packages/better-auth/src/social-providers/google.ts index 618175ec..88151ec9 100644 --- a/packages/better-auth/src/social-providers/google.ts +++ b/packages/better-auth/src/social-providers/google.ts @@ -15,7 +15,7 @@ export interface GoogleProfile { * Western languages. */ family_name: string; - /*s* + /** * The given name of the user, or first name in most * Western languages. */