StableGuide
Magic link sign-in
A magic link lets people sign in with one click from their inbox — no password to remember. The visitor types their email, receives a Sign in to … email (with your app's name) and clicks the button; they are signed in on the spot.
Magic link sign-in
A magic link lets people sign in with one click from their inbox — no password to remember. The visitor types their email, receives a Sign in to … email (with your app's name) and clicks the button; they are signed in on the spot.
When to use
- Customer portals where people sign in rarely and would forget a password.
- Staff tools on shared or mobile devices.
- Together with Email & password: both can be on, and the sign-in screen shows both options.
How to enable it
- Open Users → Sign-in and make sure Authentication is on.
- Turn on Magic link under Sign-in methods.
- Make sure email delivery is configured (a
RESEND_API_KEYsecret in Settings → Environment & secrets, or the platform key). In local development the email appears in the dev outbox. - Publish.
How it works for the visitor
- On
/login(or a Login Form set to Email me a sign-in link), the visitor enters their email and clicks Email me a sign-in link. - The screen shows "Check your inbox for a sign-in link."
- The email contains a Sign in button. The link is valid for 15 minutes and can be used once.
- Clicking it opens
/magic?token=…, which signs the visitor in and sends them to the After sign-in page (or back to the protected page they wanted).
Sign-up with a magic link
- If Allow sign-up is on and no account exists for that email, the account is created the moment the link is used. It gets the Role for new sign-ups and is marked email-verified.
- If Allow sign-up is off and the email is unknown, nothing is sent and the screen still says "Check your inbox" — this avoids revealing which emails have accounts.
- Using a magic link also marks an existing, unverified account as verified.
Example
/login → "Email me a sign-in link" → email → /magic?token=… → signed in (account created if needed)
Common mistakes
- Link opened too late or twice. After 15 minutes or one use it shows "This link is invalid or has expired." Request a new one.
- Link opened in a different app address. The link targets the address the request came from (hosted URL or custom domain); it will not sign the visitor in on another host.
- Disabled account. The link is refused with "This account is disabled."
- No email delivery in production. Without a configured key, nothing is sent on the live app.
Related
Advanced
Tokens are random, stored hashed (app_auth_tokens, kind magic), single-use, 15-minute expiry. Requests are rate-limited to 5 per 10 minutes per IP. Endpoints: POST /api/runtime/:projectId/auth/magic (request) and …/auth/magic-consume (sign in with the token).