implement better-auth auth with postgres and route protection
This commit is contained in:
14
lib/auth-client.ts
Normal file
14
lib/auth-client.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { createAuthClient } from 'better-auth/react';
|
||||
import { adminClient, magicLinkClient, organizationClient } from 'better-auth/client/plugins';
|
||||
import { resolveApiBaseURL } from '@/lib/runtime-url';
|
||||
|
||||
const baseURL = resolveApiBaseURL(process.env.NEXT_PUBLIC_API_URL);
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
baseURL: baseURL || undefined,
|
||||
plugins: [
|
||||
adminClient(),
|
||||
magicLinkClient(),
|
||||
organizationClient()
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user