- Refactor auth.ts to build OAuth providers array dynamically; extract buildOAuthProviders() for unit-testability - Add WorkOS provider (WORKOS_CLIENT_ID/SECRET/REDIRECT_URI env vars) - Add Keycloak provider with realm-scoped OIDC discovery (KEYCLOAK_URL/REALM/CLIENT_ID/CLIENT_SECRET env vars) - Add genericOAuthClient plugin to web auth-client for signIn.oauth2() - Add WorkOS + Keycloak SSO buttons to login page (NEXT_PUBLIC_*_ENABLED feature flags control visibility) - Update .env.example with SSO provider stanzas - Add 8 unit tests covering all provider inclusion/exclusion paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
10 lines
378 B
TypeScript
10 lines
378 B
TypeScript
import { createAuthClient } from 'better-auth/react';
|
|
import { adminClient, genericOAuthClient } from 'better-auth/client/plugins';
|
|
|
|
export const authClient = createAuthClient({
|
|
baseURL: process.env['NEXT_PUBLIC_GATEWAY_URL'] ?? 'http://localhost:4000',
|
|
plugins: [adminClient(), genericOAuthClient()],
|
|
});
|
|
|
|
export const { useSession, signIn, signUp, signOut } = authClient;
|