diff --git a/CLAUDE.md b/CLAUDE.md index bbe9750..45c3290 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,7 +41,6 @@ Auth is handled by `better-auth` via `lib/auth.ts` (server) and `lib/auth-client - `MONGO_URI` — MongoDB connection string - `ADMIN_EMAIL` — Only email allowed to log in - `BETTER_AUTH_SECRET` — Auth secret key -- `BETTER_AUTH_URL` — Auth base URL (defaults to `http://localhost:3000`) - `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` — GitHub OAuth app (optional) - `NEXT_PUBLIC_GITHUB_ENABLED` — Set to enable GitHub OAuth login on the client - `SMTP_USER` / `SMTP_PASS` / `FROM_EMAIL` — Email via wirtanen.uberspace.de:465 @@ -64,4 +63,4 @@ Frontend dates use `dd.MM.yyyy`; backend/DB uses `yyyy-MM-dd`. Helpers in `helpe - `GET/PATCH /api/bookings/[uuid]` — Get or update booking - `GET /api/daysbooked` — Returns booked days array (JSON) - `GET /api/daysbooked.ics` — Returns booked days as iCal feed -- `/api/auth/[...all]` — better-auth handler +- `/api/auth/[...all]` — better-auth handler \ No newline at end of file diff --git a/pages/api/auth/[...all].ts b/pages/api/auth/[...all].ts index 1383f6a..1da9cb6 100644 --- a/pages/api/auth/[...all].ts +++ b/pages/api/auth/[...all].ts @@ -1,3 +1,4 @@ +import { getBaseURL } from "../../../helpers/url" import { auth } from "../../../lib/auth" import type { NextApiRequest, NextApiResponse } from "next" @@ -8,7 +9,7 @@ export const config = { } export default async function handler(req: NextApiRequest, res: NextApiResponse) { - const baseUrl = process.env.BETTER_AUTH_URL || "http://localhost:3000" + const baseUrl = getBaseURL() const url = new URL(req.url!, baseUrl) let body: Buffer | undefined @@ -34,4 +35,4 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) res.setHeader(key, value) }) res.end(await response.text()) -} +} \ No newline at end of file