Files
classroomio/apps/dashboard/src/lib/utils/services/auth/client.ts
T

21 lines
648 B
TypeScript
Raw Normal View History

import { createAuthClient } from 'better-auth/svelte';
import { getRequestBaseUrl } from '$lib/utils/services/api';
2026-03-09 11:18:22 +01:00
import { ssoClient } from '@better-auth/sso/client';
// Server: PRIVATE_SERVER_URL (Render internal). Browser: same-origin /api
// through the Cloudflare Worker proxy, so auth cookies stay host-only on
// whichever domain the user is on (app, tenant subdomain, or BYOD).
export const authClient = createAuthClient({
baseURL: getRequestBaseUrl(),
fetchOptions: {
credentials: 'include' // Include cookies in requests
2026-03-09 11:18:22 +01:00
},
plugins: [
ssoClient({
domainVerification: {
enabled: true
}
})
]
});