Skip to content

feat(web): move auth off server actions (by Lumen)#249

Open
conoremclaughlin wants to merge 3 commits intomainfrom
lumen/feat/auth-route-handlers
Open

feat(web): move auth off server actions (by Lumen)#249
conoremclaughlin wants to merge 3 commits intomainfrom
lumen/feat/auth-route-handlers

Conversation

@conoremclaughlin
Copy link
Owner

Summary

  • replace client-invoked auth server actions with explicit Next route handlers for password login, OTP login, signup, OAuth, and logout
  • add a thin client auth API layer so login/signup/social/sidebar flows all use HTTP boundaries instead of direct server-action calls
  • preserve existing MCP callback handling and PCP refresh-token revocation on logout

Why

Next dev was logging server action arguments, including plaintext password values for signInWithPassword(...). Moving auth to route handlers removes that exception from the stack and makes auth easier to automate and extend for future providers.

Validation

  • cd packages/web && npx vitest run src/lib/auth/server-auth.test.ts src/app/api/auth/logout/route.test.ts
  • cd packages/web && python3 - <<'PY' import shutil shutil.rmtree('.next', ignore_errors=True) PY yarn type-check
  • manual dev check: POST /api/auth/login now logs only the route/timing, not the submitted password args

Notes

  • current branch/worktree still has unrelated untracked operational files from the Supabase local cutover; they are not part of this PR.

Route password, OTP, signup, OAuth, and logout through Next route handlers
instead of client-invoked server actions. This removes plaintext password
arguments from Next dev server-action logs, keeps auth as an explicit HTTP
boundary for future provider additions, and preserves MCP callback plus PCP
refresh-token revocation behavior.
Handle non-2xx auth route responses as structured error payloads and
restore mocked fetch cleanup in the logout route test to prevent spy
leakage between Vitest files.
Catch retryable Supabase auth fetch/socket failures in the shared server-auth
helpers and return a user-facing explanation instead of leaking  or other
opaque auth errors when the local Supabase stack is unhealthy.
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