# NEXT SESSION, from Designer (12 Nov 2026, SAST)

What still has to happen before sign-in and sign-up can go live. The design is done and lives in `components/auth-signin-signup/`. Everything here is wiring or a decision. **Preview only: nothing is merged, deployed or live.**

## For MT (only you can do these)

1. **Create the Google sign-in client** (about 15 minutes, free):
   1. Go to [console.cloud.google.com](https://console.cloud.google.com/) and create a project called "Go Around".
   2. Under *Google Auth Platform → Branding*, set up the OAuth consent screen:
      - app name **Go Around**, a support email, and the app domain;
      - links to the Privacy Policy and Terms;
      - scopes `openid`, `email`, `profile` only.
      - You can add the logo later; there's no logo yet.
   3. Under *Clients*, create a **Web application** client:
      - Authorised JavaScript origin: the final site domain.
      - Redirect URI: `https://<final domain>/api/auth/google/callback`.
      - Add the preview domain too while testing.
   4. Give Go Around the **Client ID** and **Client secret** through Cloudflare secrets, never in chat or Git.
   5. Publish the consent screen (Testing → In production). Using only openid/email/profile needs no Google review.
2. **Decide on passwords:** keep email + password (DECISIONS-MASTER), or go password-free with Google + email code + passkey. The server today is password-free. Designer recommends password-free. The design works either way.
3. **Decide on the email code at sign-up:** DECISIONS says sign-up confirms the email with a 6-digit code. Go Around's current preview skips it, and it also says "This email already has an account", which tells strangers who is a member. Designer recommends: code first, and the same answer whether or not the email has an account.
4. **Pick the final domain before launch.** Passkeys are tied to it forever.
5. **Say "merge"** on the design PR when you're happy (go-around-design). Going live is a separate yes.

## For Go Around (technical wiring; the design calls only `auth-hooks.js`)

| # | Task | Hook in the design | Server status |
|---|---|---|---|
| 1 | Google start: state, nonce and PKCE stored for 10 min; 302 to Google with `openid email profile`, `prompt=select_account` | `startGoogleOAuth(mode)` | **New** |
| 2 | Google callback: check state, exchange code, verify the ID token (iss, aud, exp, nonce, `email_verified`). Known `sub` or verified email → session. New → sign-up ticket → `identity?via=google` with name and email filled in, **no password step** | `handleOAuthCallback(state)` | **New** (reuse the email-code sign-up ticket from `data_auth.mjs`) |
| 3 | Store `google_sub` on the account. Link only by verified email. | n/a | **New** (migration) |
| 4 | Passkey sign-in: wire `navigator.credentials.get` to `/api/auth/passkey/signin-options` + `/signin`. Replace the stand-in sheet (`passkeySheet()` in mock.js) with the real call. | `passkeySignIn()` | Exists on `job6/member-doorways` |
| 5 | "Add a passkey" on the done screen and in Settings: `navigator.credentials.create` with `residentKey:'required'`, `userVerification:'required'` | `passkeyRegister(label)` | Exists (signed-in only) |
| 6 | Accept RS256 (`-257`) as well as ES256 (`-7`) in `admin_auth.mjs` (some Windows Hello keys) | n/a | **Change** |
| 7 | Set `MEMBER_RP_ID` and `SITE_ORIGIN` to the final domain | n/a | Config |
| 8 | Email sign-in code from the sign-in screen ("Email me a sign-in code instead" → verify screen) | `sendEmailCode(email)`, `verifyEmailCode(email, code)` | Exists (`/api/auth/email/start`, `/verify`) |
| 9 | Password sign-in, sign-up, forgot and reset, **if MT keeps passwords** | `signInWithPassword`, `signUpWithPassword`, `requestPasswordReset`, `resetPassword` | **Not built** |
| 10 | In-app browsers (Instagram, Facebook, TikTok, WhatsApp): detect them from the User-Agent and show "Open in Safari to sign in" above the buttons. Google and passkeys fail there. | n/a | **New** (front-end) |
| 11 | Founding seat number on the receipt and done screen ("No. 39 of 50" is a placeholder) | n/a | Payments |
| 12 | Keep Go Around's 81 edge checks green. The Designer copy passes all 81 of his checks (81/81, 12 Nov). Re-run `tests/edge_build2.py` against the real build. | n/a | n/a |

### Rules for the wiring
- Never touch `gate.ts`, `appdata/`, `wm-pin.js` or `site/wm-core.js`.
- Keep the Google button exactly as designed: official G, Google Sans, light/dark per theme. Google's branding rules are a condition of app verification.
- The Google and passkey buttons are deliberately **not** `.pb` pills, so the existing tests that find pills by text keep working.

— Designer
