Skip to content

Commit c9f4483

Browse files
ryan-williamsclaude
andcommitted
Demo: don't offer sign-ins that can't complete
Without a Google client id the panel now omits `googleUrl` (no dead-end 503 page), and the staff SSO button is hidden under `pnpm dev`, where no Cloudflare Access fronts `/auth/sso` so it can only 401. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DyJyzSYpRxJuL6x6NyjpG3
1 parent c69f2cb commit c9f4483

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎demo/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Step 5 is the load-bearing one: grant-backed sessions re-join their grant row on
2727
**Simulated, and labelled as such in the page:**
2828

2929
- **Mail.** `emailCodeAuth`'s `start` reply never says whether mail went out (so the form can't probe who's allowed), and delivery *is* the verification. This demo has no sending domain for most visitors, so its `send` captures the message instead of mailing it, stashes it in a short-lived `HttpOnly` cookie only your browser can read back (`GET /auth/email/outbox`), and the form shows you the code and link. That proves nothing about the address, and the page says so. Mail really goes out only when `RESEND_API_KEY` + `MAIL_FROM` are set *and* the recipient's domain is in `MAIL_DOMAINS` — a public form that mails whatever address a stranger types is a spam cannon pointed at other people.
30-
- **Google.** Without `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET`, `/auth/google/*` answers 503, One Tap doesn't render, and the page says so rather than hiding the buttons. Google exposes no API to create the client; `scripts/provision-oauth-client.mjs` walks the one manual step.
30+
- **Google.** Without `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET`, `/auth/google/*` answers 503, so the page drops One Tap and the Google button (and says why) rather than offering a sign-in that can't complete. The staff SSO button is likewise hidden under `pnpm dev`, where no Cloudflare Access sits in front of `/auth/sso`. Google exposes no API to create the client; `scripts/provision-oauth-client.mjs` walks the one manual step.
3131
- **The directory sync.** `Admin → Allowlist → Sync now` `replaceSource`s `sync:staff@example.org` with a random subset of a five-person roster, returning the same `[{ group, source, count }]` shape `syncGroupsToAllowlist` returns. A real deployment puts that call at the marked spot in `functions/api/admin/[[path]].ts`, with a service-account key. The table isn't wired into any policy here (the demo admits any address) — which demonstrates a real property: mounting the editor never changes who gets in; `allowlistPolicy(store)` in the gate's `policy` is the separate line that does.
3232

3333
## Two gates, one grants table

‎demo/src/SignIn.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ export function SignIn({ onSignedIn, title }: { onSignedIn: () => void; title?:
3434
/>
3535
) : google.isSuccess ? (
3636
<p className="muted small inert">
37-
No Google client id is configured on this deployment, so One Tap doesn't render and{' '}
38-
<em>Continue with Google</em> answers 503. They're shown anyway because they're part of the panel; Google
39-
offers no API to create the client, and <code>scripts/provision-oauth-client.mjs</code> walks the one
37+
No Google client id is configured on this deployment, so there's no One Tap and no{' '}
38+
<em>Continue with Google</em> — the panel drops a sign-in it can't complete, as any deployment should.
39+
Google offers no API to create the client; <code>scripts/provision-oauth-client.mjs</code> walks the one
4040
manual step.
4141
</p>
4242
) : null}
4343
<SignInPanel
4444
title={title}
45-
googleUrl="/auth/google/start?next=%2Fdashboard"
46-
signInUrl="/auth/sso?next=%2Fdashboard"
45+
googleUrl={clientId ? '/auth/google/start?next=%2Fdashboard' : undefined}
46+
// Cloudflare Access fronts `/auth/sso` only on the deployed host; in local dev it can only 401.
47+
signInUrl={import.meta.env.DEV ? undefined : '/auth/sso?next=%2Fdashboard'}
4748
signInLabel="Sign in with SSO (staff)"
4849
withNext={false}
4950
emailAuth={{

0 commit comments

Comments
 (0)