docs: imprvoe account linking docs

This commit is contained in:
Bereket Engida
2024-10-20 07:12:30 +03:00
parent 3962b5aec5
commit 6467af1685
3 changed files with 8 additions and 13 deletions

View File

@@ -38,6 +38,11 @@ export const auth = betterAuth({
},
sendOnSignUp: true,
},
account: {
accountLinking: {
trustedProviders: ["google", "github"],
},
},
emailAndPassword: {
enabled: true,
async sendResetPassword(user, url) {

View File

@@ -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: {

View File

@@ -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.
*/