| 1 | import { createAuthClient } from "better-auth/react"; // make sure to import from better-auth/react |
| 2 | |
| 3 | const authBaseURL = |
| 4 | typeof window !== "undefined" |
| 5 | ? window.location.origin |
| 6 | : process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000"; |
| 7 | |
| 8 | export const authClient = createAuthClient({ |
| 9 | baseURL: authBaseURL, |
| 10 | }); |
| 11 | |
| 12 | export const { signIn, signUp, signOut, useSession, getSession, linkSocial } = |
| 13 | authClient; |