AddThisFeature

Magic Link Sign-In

Sign in from an emailed link instead of remembering a password.

involved User Accounts

What it adds

Passwordless authentication by email: a short-lived single-use link, purpose-bound tokens, and defined behaviour when the link opens somewhere unexpected.

What your agent is told to do

5
  1. 1

    Make links short-lived — minutes, not hours — single-use, and bound to the purpose they were issued for. A sign-in token must not also work as a reset or invite token.

  2. 2

    Bind the request to the browser that started it: issue a paired value on the request page and require it, so a link opened on another device follows the handoff path instead of silently signing in.

  3. 3

    Give the same response to every address entered, and never reveal whether an account exists at any step.

  4. 4

    Validate the post-login destination against an allowlist and drop anything external.

  5. 5

    Do not make magic links the only way in for accounts that matter. Email is a single point of failure; keep at least one other method available and say so at sign-up.

Edge cases it handles

6
  • Opening the link on a different device or browser must offer an explicit confirmation step rather than failing or silently authenticating.
  • Link scanners in corporate mail systems will hit the URL before the user does — consuming the token on GET breaks sign-in entirely for those users.
  • Requesting a second link must invalidate the first, and the emails must be distinguishable so people do not click the stale one.
  • A consumed or expired link must show a neutral 'request a new one' screen with no account details.
  • Requests must be rate-limited per address and per IP; the endpoint sends email on demand.
  • The token must not survive in browser history, referrer headers, or server logs after use.

Definition of done

8
  • Links expire in minutes, are single-use, and are valid only for sign-in.
  • A link opened in a different browser requires explicit confirmation.
  • Pre-fetching by mail scanners does not consume the token.
  • Post-login redirects are allowlisted and never external.
  • Responses never disclose whether an address is registered.
  • An alternative sign-in method remains available on every account.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.