Skip to content

Phase 1 (frontend): login flow, auth context, workspace switcher#10

Closed
kosminus wants to merge 1 commit into
claude/phase1-identity-authfrom
claude/phase1-frontend-auth
Closed

Phase 1 (frontend): login flow, auth context, workspace switcher#10
kosminus wants to merge 1 commit into
claude/phase1-identity-authfrom
claude/phase1-frontend-auth

Conversation

@kosminus

@kosminus kosminus commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Frontend half of Phase 1, built against the new auth API. Stacked on #9 (base = claude/phase1-identity-auth) so this diff is frontend-only — merge #9 first.

Session is an HTTP-only cookie, so the client never handles tokens — it sends credentials and derives auth state from /auth/me.

What's included

  • api/client.tswithCredentials, an X-Workspace-Id request-header injector, and a global 401 → drop-session handler (auth endpoints excluded to avoid loops).
  • AuthContext + useAuth — loads /auth/me, exposes user/workspaces/role, persists the active-workspace choice, refresh/logout, and resets the query cache on workspace switch + logout (no cross-workspace data bleed).
  • LoginPage — provider-aware (password + register toggle and/or magic-link, driven by GET /auth/providers); surfaces the dev magic-link token locally. MagicLinkVerifyPage handles /login/verify?token=.
  • ProtectedRoute + routing — public /login + /login/verify, all app routes gated.
  • AppLayout header — workspace switcher, role badge, account menu with sign-out.

Verification

  • npm run build (tsc + vite) — clean
  • npm run lint — clean
  • No new dependencies.

Note

End-to-end browser verification needs the new backend running with DISABLE_AUTH=false (the stack currently runs the pre-auth image).

🤖 Generated with Claude Code

Frontend half of Phase 1, built against the new auth API. Session is an
HTTP-only cookie, so the client never handles tokens — it sends credentials
and derives auth state from /auth/me.

- client.ts: withCredentials, X-Workspace-Id request header, global 401 ->
  drop-session handler (auth endpoints excluded to avoid loops)
- AuthContext + useAuth: loads /auth/me, exposes user/workspaces/role,
  active-workspace selection (persisted), refresh/logout, query-cache reset
  on workspace switch + logout
- LoginPage: provider-aware (password + register toggle, magic-link), dev
  token surfaced for local magic-link; MagicLinkVerifyPage for /login/verify
- ProtectedRoute guard; App.tsx public /login + /login/verify, app routes
  gated behind auth
- AppLayout header: workspace switcher, role badge, account menu with sign-out
- authApi client + auth types

Builds (tsc + vite) and lints clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kosminus kosminus deleted the branch claude/phase1-identity-auth June 5, 2026 11:11
@kosminus kosminus closed this Jun 5, 2026
@kosminus kosminus deleted the claude/phase1-frontend-auth branch June 5, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant