kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1import { apiKeyClient } from "@better-auth/api-key/client";
2import {
3 anonymousClient,
4 emailOTPClient,
5 genericOAuthClient,
6 lastLoginMethodClient,
7 magicLinkClient,
8 organizationClient,
9} from "better-auth/client/plugins";
10import { createAuthClient } from "better-auth/react";
11import { ac, admin, member, owner } from "./permissions";
12
13const getBaseURL = () => {
14 const apiUrl = import.meta.env.VITE_API_URL || "http://localhost:1337";
15 try {
16 const url = new URL(apiUrl);
17 return `${url.protocol}//${url.host}`;
18 } catch {
19 return apiUrl.split("/").slice(0, 3).join("/");
20 }
21};
22
23export const authClient = createAuthClient({
24 baseURL: getBaseURL(),
25 basePath: "/api/auth",
26 plugins: [
27 anonymousClient(),
28 lastLoginMethodClient(),
29 magicLinkClient(),
30 emailOTPClient(),
31 organizationClient({
32 ac,
33 roles: {
34 member,
35 admin,
36 owner,
37 },
38 }),
39 genericOAuthClient(),
40 apiKeyClient(),
41 ],
42});