Files
CatoandClaude e3c7656960 feat(auth): account mail through AccountKit's shared mailer, with the sign-in code (#77)
The account mails stay this app's own words, in the reader's language, with
HTML: the template is handed to createAuthMailer({ render, codes: true })
(AccountKit 0.26.1). The shared mailer checks the link's origin, skips
addresses that cannot receive mail and puts a six-digit code in the sign-in
link's email, which the template prints ("On another device? Type this
code ..."). The sign-in page then offers the field for it.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 00:48:27 +01:00

25 lines
857 B
TypeScript

import { createAuthRuntime } from "@bitbaum/accountkit/auth/next";
import { getDb, isDatabaseConfigured, schema } from "@/lib/db/client";
import { authMail } from "@/lib/mail";
import { SITE } from "@/lib/site";
/** Shared account lifecycle over the existing tables; no identity or data migration. */
export const { GET, POST, getAuth, authStatus, getSession, requireUser } = createAuthRuntime({
site: SITE,
getDatabase: getDb,
isDatabaseConfigured,
schema: {
user: schema.user,
session: schema.session,
account: schema.account,
verification: schema.verification,
passkey: schema.passkey,
twoFactor: schema.twoFactor,
},
mail: authMail,
});
export type Auth = ReturnType<typeof getAuth>;
export type { AuthStatus } from "@bitbaum/accountkit/auth/server";
export { oidcProvider } from "@bitbaum/accountkit/auth/server";