Files
claudemesh/apps/web/src/config/auth.ts
Alejandro Gutiérrez e8ad7a5b19
Some checks failed
CI / Tests / 🧪 Test (push) Has been cancelled
fix(web): auth UX polish batch — guest button, oauth labels
Three launch-visible friction fixes:

#3: "Continuar como invitado" (anonymous sign-in) removed. claudemesh
    requires an account — mesh membership, invite issuance, and audit
    trails are all tied to a user.id. Flipping the toggle is enough:
    the AnonymousLogin component is gated by
    `authConfig.providers.anonymous` in login.tsx, so disabling the
    flag makes the button disappear from both /login and /register.

#4: OAuth buttons now show proper brand labels. Was rendering lowercase
    "github" / "google" / "apple" via capitalize CSS (which users read
    as "is this broken?"). Now renders "Continue with GitHub" /
    "Continue with Google" / "Continue with Apple" next to the existing
    brand icons. Also swapped layout: was `grow basis-28` (side-by-side
    chips), now `w-full justify-center` (stacked full-width buttons) —
    matches claude.com login styling more closely.

#6: Session hydration race on /dashboard — NON-ISSUE verified. The
    0-mesh redirect runs in a Server Component AFTER
    /dashboard/layout.tsx's getSession() gate. Server api.ts forwards
    cookies to the Hono backend, so no client-side auth state is in
    play. No fix needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 14:55:09 +01:00

26 lines
1007 B
TypeScript

import env from "env.config";
import { SocialProvider, authConfigSchema } from "@turbostarter/auth";
import type { AuthConfig } from "@turbostarter/auth";
/** Coerce env value to boolean (handles both parsed booleans and raw strings) */
const toBool = (val: unknown, fallback: boolean): boolean => {
if (typeof val === "boolean") return val;
if (val === "true" || val === "1") return true;
if (val === "false" || val === "0") return false;
return fallback;
};
export const authConfig = authConfigSchema.parse({
providers: {
password: toBool(env.NEXT_PUBLIC_AUTH_PASSWORD, true),
magicLink: toBool(env.NEXT_PUBLIC_AUTH_MAGIC_LINK, false),
passkey: toBool(env.NEXT_PUBLIC_AUTH_PASSKEY, true),
// claudemesh requires auth — mesh membership is tied to an account
anonymous: toBool(env.NEXT_PUBLIC_AUTH_ANONYMOUS, false),
// v0.1.0: GitHub + Google. Apple deferred until we need it.
oAuth: [SocialProvider.GOOGLE, SocialProvider.GITHUB],
},
}) satisfies AuthConfig;