docs: improve clerk migration guide (#2746)

This commit is contained in:
KinfeMichael Tariku
2025-05-22 02:13:56 -07:00
committed by GitHub
parent c1a4809b03
commit 2fdcd6ee5c

View File

@@ -41,7 +41,7 @@ export const auth = betterAuth({
Enable the email and password in your auth config and implement your own logic for sending verification emails, reset password emails, etc. Enable the email and password in your auth config and implement your own logic for sending verification emails, reset password emails, etc.
```ts title="auth.ts" ```ts title="auth.ts"
import { admin, anonymous } from "better-auth/plugins"; import { betterAuth } from "better-auth";
export const auth = betterAuth({ export const auth = betterAuth({
database: new Pool({ database: new Pool({
@@ -52,8 +52,7 @@ export const auth = betterAuth({
}, // [!code highlight] }, // [!code highlight]
emailVerification: { emailVerification: {
sendVerificationEmail: async({ user, url })=>{ sendVerificationEmail: async({ user, url })=>{
// send email verification email // implement your logic here to send email verification
// implement your own logic here
} }
}, },
}) })
@@ -67,7 +66,7 @@ See [Email and Password](/docs/authentication/email-password) for more configura
Add social providers you have enabled in your Clerk project in your auth config. Add social providers you have enabled in your Clerk project in your auth config.
```ts title="auth.ts" ```ts title="auth.ts"
import { admin, anonymous } from "better-auth/plugins"; import { betterAuth } from "better-auth";
export const auth = betterAuth({ export const auth = betterAuth({
database: new Pool({ database: new Pool({
@@ -142,7 +141,7 @@ export const auth = betterAuth({
<Step> <Step>
### Create the migration script ### Create the migration script
Create a new file called `migrate-clerk.ts` in your project and add the following code: Create a new file called `migrate-clerk.ts` in the `scripts` folder and add the following code:
```ts title="scripts/migrate-clerk.ts" ```ts title="scripts/migrate-clerk.ts"
import { symmetricEncrypt } from "better-auth/crypto"; import { symmetricEncrypt } from "better-auth/crypto";
@@ -406,7 +405,6 @@ migrateFromClerk()
console.error(error); console.error(error);
return; return;
} }
// Handle successful sign in // Handle successful sign in
}; };