Guides
Auth adapters
Resolve end-user identity through Clerk, WorkOS, or better-auth with the adapter that matches the host app.
Supported adapters
Auth adapter docs should stay aligned with the adapters that actually ship.
Clerk
WorkOS
better-auth
{ id, email, name }
what Clivly consumes
Swapping providers changes the body of one function — nothing else.
Clerk — Use when the host app resolves sessions through Clerk. Peer dependency: @clerk/backend >= 1.
WorkOS — Use when the host app resolves sessions through WorkOS AuthKit. Peer dependency: @workos-inc/node >= 7.
better-auth — Use when the host app already has a better-auth instance. No peer dependency — you pass your own instance.
- Auth adapters are optional. You do not need one to sync data into Clivly. Reach for one only when a Clivly surface must resolve which of your users is making a request.
- They answer "who is this person?" only. CRM authorization lives separately in Clivly's
crm_memberslayer. - All three return
nullwhen there is no session, or when the session user has no email address — Clivly requires one. - Install the peer dependency yourself; Clivly does not pull it in.
Clerk
Clerk remains a first-class adapter with optional peer dependencies.
import { createClerkAuthAdapter } from "clivly/auth/clerk";
const authAdapter = createClerkAuthAdapter({
secretKey: process.env.CLERK_SECRET_KEY!,
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
});
const user = await authAdapter.getUser(request);WorkOS
WorkOS remains a first-class adapter with provider credentials and cookie password handling.
import { createWorkOSAuthAdapter } from "clivly/auth/workos";
const authAdapter = createWorkOSAuthAdapter({
apiKey: process.env.WORKOS_API_KEY!,
clientId: process.env.WORKOS_CLIENT_ID!,
cookiePassword: process.env.WORKOS_COOKIE_PASSWORD!,
});
const user = await authAdapter.getUser(request);better-auth
better-auth is now part of the public integration surface and should not be missing from the docs route.
import { createBetterAuthAdapter } from "clivly/auth/better-auth";
import { auth } from "./auth";
const authAdapter = createBetterAuthAdapter({ auth });
const user = await authAdapter.getUser(request);