import { createAuthClient } from 'better-auth/react'; import { magicLinkClient, adminClient, inferAdditionalFields } from 'better-auth/client/plugins'; // Better Auth client. Sessions are httpOnly cookies set by the backend; with // NEXT_PUBLIC_API_URL unset everything is same-origin through the Next.js // rewrites (see next.config.js), so cookies flow automatically. export const authClient = createAuthClient({ baseURL: process.env.NEXT_PUBLIC_API_URL || '', plugins: [ magicLinkClient(), adminClient(), inferAdditionalFields({ user: { phone: { type: 'string', required: false }, languagePreference: { type: 'string', required: false }, rucNumber: { type: 'string', required: false }, isClaimed: { type: 'boolean', required: false }, accountStatus: { type: 'string', required: false }, }, }), ], });