mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 12:27:43 +00:00
docs: imprvoe account linking docs
This commit is contained in:
@@ -38,6 +38,11 @@ export const auth = betterAuth({
|
||||
},
|
||||
sendOnSignUp: true,
|
||||
},
|
||||
account: {
|
||||
accountLinking: {
|
||||
trustedProviders: ["google", "github"],
|
||||
},
|
||||
},
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
async sendResetPassword(user, url) {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user