Better Auth Configuration: - Database adapter for PostgreSQL with custom schema mapping - Email/password authentication enabled - 7-day session expiration with 24-hour update frequency - Custom field mappings for auth_user, auth_session, auth_account tables - Server-side auth helpers: getSession(), requireAuth() - Client-side React hooks: signIn, signOut, signUp, useSession Authentication Pages: - /login: Email/password login with error handling - /forgot-password: Password reset request flow - /account-request: New user registration form - Captures: name, email, phone, company, Epicor ID, message - Creates quest_account_request record for admin approval - Success confirmation with next steps API Routes: - /api/auth/[...all]: Better Auth handler for all auth operations - /api/account-request: Account request submission endpoint UI Components: - Added Textarea component from shadcn/ui - Form validation and loading states - Toast notifications for user feedback - Responsive card-based layouts Session management and enhanced context (company, permissions) will be added in F-008 middleware implementation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
9 lines
266 B
TypeScript
9 lines
266 B
TypeScript
'use client';
|
|
|
|
import { createAuthClient } from 'better-auth/react';
|
|
|
|
export const authClient = createAuthClient({
|
|
baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL || 'http://localhost:3000',
|
|
});
|
|
|
|
export const { signIn, signOut, signUp, useSession } = authClient;
|