Commit 63924db
authored
fix(auth): pass callbackPath through magic link sign-in flow (#1318)
## Summary
- Fix `callbackPath` being dropped when users sign in via the magic link
method. OAuth flows (Google, GitHub, WorkOS, etc.) correctly threaded
`callbackPath` through `getSignInCallbackUrl(params)`, but
`handleSendMagicLink` only sent the email address — ignoring `params`
entirely.
- The backend already fully supported `callbackUrl` end-to-end (API
route zod schema, email builder, magic link URL generator,
verify-magic-link page). The only gap was the frontend never sending the
value. This two-file change closes that gap.
## Verification
- [x] `pnpm typecheck` — passed
- [x] `pnpm lint` (via pre-commit hook) — passed
- [x] `pnpm format:check` (via pre-commit hook) — passed
- [x] Manual browser test: navigated to
`/users/sign_in?callbackPath=/organizations/new`, clicked "Continue with
Email", confirmed flow reaches Turnstile with callbackPath still in the
URL context (Turnstile challenge blocked full end-to-end automated test)
## Visual Changes
N/A
## Reviewer Notes
- The fix mirrors exactly how every OAuth provider in `useSignInFlow.ts`
handles `callbackPath` — via `getSignInCallbackUrl(params)`.
- Zero backend changes: the API route (`/api/auth/magic-link`),
`sendMagicLinkEmail`, `getMagicLinkUrl`, and `verify-magic-link` page
all already accepted and forwarded `callbackUrl`. Only the client-side
call site was missing it.
- `params` was added to the `useCallback` dependency array for
`handleSendMagicLink` since it now reads from it.2 files changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
| 387 | + | |
387 | 388 | | |
388 | 389 | | |
389 | 390 | | |
| |||
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
404 | | - | |
| 405 | + | |
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
17 | | - | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
0 commit comments