Phase 1 (frontend): login flow, auth context, workspace switcher#11
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Frontend half of Phase 1, built against the auth API from #9 (now merged to
main). Diff is frontend-only.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.ts—withCredentials,X-Workspace-Idrequest-header injector, global 401 → drop-session handler (auth endpoints excluded to avoid loops).AuthContext+useAuth— loads/auth/me, exposesuser/workspaces/role, persists the active-workspace choice,refresh/logout, resets the query cache on workspace switch + logout.LoginPage— provider-aware (password + register toggle and/or magic-link, fromGET /auth/providers); dev magic-link token surfaced locally.MagicLinkVerifyPagefor/login/verify?token=.ProtectedRoute+ routing — public/login+/login/verify, app routes gated.AppLayoutheader — workspace switcher, role badge, account menu with sign-out.Verification
npm run build(tsc + vite) — cleannpm run lint— cleanNote
Replaces #10 (auto-closed when the stacked base branch was deleted on merge of #9). End-to-end browser verification needs the backend running with
DISABLE_AUTH=false.🤖 Generated with Claude Code