Skip to content

fix(magic-link): build redirect from a dedicated frontend_url config#75

Merged
Bccorb merged 1 commit into
mainfrom
fix/magic-link-frontend-url
Jul 10, 2026
Merged

fix(magic-link): build redirect from a dedicated frontend_url config#75
Bccorb merged 1 commit into
mainfrom
fix/magic-link-frontend-url

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Magic-link emails were built from config.origins[0], so the emailed link pointed at whichever origin happened to be first. Depending on origin ordering that can be a non-frontend host (for example an API origin), so the link did not land on the page that verifies it.

Change

  • Add an optional frontend_url system config (env FRONTEND_URL), wired through the schema and env map.
  • magicLinks.ts now builds the redirect from config.frontend_url ?? config.origins[0], so it uses the real frontend URL and falls back to the old behavior when unset (backward compatible).
  • Adds a test asserting frontend_url wins regardless of origin order.

Testing

  • npm run build, npm run lint, npm run typecheck, npm run format:check all pass.
  • npm run test:run passes (73 test files), including the new magic-link case.

Release

Includes a patch changeset for seamless-auth-api.

Magic links were built from origins[0], so the emailed link pointed at whichever
origin happened to be first, which could be a non-frontend host (for example an
API origin). Add an optional frontend_url system config (env FRONTEND_URL) and
use it as the base for the redirect, falling back to origins[0] when unset.
@Bccorb Bccorb merged commit f4be2ae into main Jul 10, 2026
2 of 3 checks passed
@Bccorb Bccorb deleted the fix/magic-link-frontend-url branch July 10, 2026 15:41
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