AUTH STARTER · MAGIC LINK
Magic link
Passwordless sign-in via a one-time email link. Requires Resend, otherwise the link logs to console.
Magic links are the easiest auth method for users — type your email, click the link, you're in. The tradeoff is your email deliverability. If links land in spam, your sign-up funnel breaks silently.
Turn it on
// src/auth.config.ts
plugins: {
magicLink: { enabled: true },
},# .env.local
RESEND_API_KEY="re_..."
EMAIL_FROM="You <hello@yourdomain.com>"Send the link (client)
await authClient.signIn.magicLink({
email,
callbackURL: "/dashboard", // where to land after the link is clicked
});The email template
Lives at src/lib/emails/magic-link-email.tsx. React Email components with inline styles. The render function is plumbed through src/lib/email.ts → sendMagicLinkEmail.
DKIM, DKIM, DKIM
If you skip the DNS records Resend gives you, your magic links go straight to spam. Verify your sender domain in Resend, paste the DKIM and SPF records into DNS, wait 10 minutes. Send yourself one, check the headers. If you see "dkim=pass" you're good.
EMAIL_FROM format matters
Use either "you@domain.com" or "Name <you@domain.com>". The Zod regex in env.ts enforces it — if your boot fails with an email error, that's why.
Magic links use the verification table
No extra DB table needed. Tokens land in the existing verification table, expire by default in 5 minutes (Better Auth default), single-use.