The passkey plugin was previously imported from `better-auth/plugins` instead of its dedicated package `@better-auth/passkey`. This change corrects the import path to resolve the issue.
33 lines
820 B
TypeScript
33 lines
820 B
TypeScript
import { betterAuth } from 'better-auth';
|
|
import { organization, magicLink } from 'better-auth/plugins';
|
|
import { passkey } from '@better-auth/passkey'; // separate package!
|
|
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
|
|
import { db } from '@/db';
|
|
|
|
const baseURL = process.env.BETTER_AUTH_URL || 'http://localhost:3001';
|
|
|
|
export const auth = betterAuth({
|
|
baseURL,
|
|
database: drizzleAdapter(db, {
|
|
provider: 'pg',
|
|
}),
|
|
emailAndPassword: {
|
|
enabled: true,
|
|
},
|
|
plugins: [
|
|
organization(),
|
|
passkey(),
|
|
magicLink({
|
|
sendMagicLink: async ({ email, url }) => {
|
|
console.log(`Magic link for ${email}: ${url}`);
|
|
},
|
|
}),
|
|
],
|
|
trustedOrigins: [
|
|
baseURL,
|
|
'bagsy://',
|
|
'bagsy://localhost',
|
|
'http://localhost:3001',
|
|
'http://192.168.*:3001',
|
|
],
|
|
});
|