From 6467af16858532aba3f14fcbfa366dbcf6d21c9f Mon Sep 17 00:00:00 2001 From: Bereket Engida Date: Sun, 20 Oct 2024 07:12:30 +0300 Subject: [PATCH] docs: imprvoe account linking docs --- demo/nextjs/lib/auth.ts | 5 +++++ docs/content/docs/concepts/users-accounts.mdx | 14 ++------------ .../better-auth/src/social-providers/google.ts | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/demo/nextjs/lib/auth.ts b/demo/nextjs/lib/auth.ts index 12db8b4ada..17f4fd680f 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 367196fa4a..e302c81f85 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 618175ec65..88151ec95d 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. */