initial better auth config

This commit is contained in:
2025-11-06 11:42:48 -03:00
parent ffeab9cace
commit ca51839082
20 changed files with 1629 additions and 1365 deletions

View File

@@ -1,21 +1,13 @@
/**
* Cliente Better Auth para frontend SvelteKit
*
*
* Configurado para trabalhar com Convex via plugin convexClient.
* Este cliente será usado para autenticação quando Better Auth estiver ativo.
*/
import { createAuthClient } from "better-auth/svelte";
import { convexClient } from "@convex-dev/better-auth/client/plugins";
export const authClient = createAuthClient({
// Base URL da API Better Auth (mesma do app)
baseURL: typeof window !== "undefined"
? window.location.origin // Usar origem atual em produção
: "http://localhost:5173", // Fallback para desenvolvimento
plugins: [
// Plugin Convex integra Better Auth com Convex backend
convexClient({
convexUrl: import.meta.env.PUBLIC_CONVEX_URL || "",
}),
],
plugins: [convexClient()],
});