Skip to main content

Email Link and Code

Email authentication sends one challenge containing both a one-time sign-in link and a six-digit code. Redeeming either credential consumes the shared challenge.

How It Works

SDK Usage

Step 2: Handle the Callback

On your callback page (e.g. /auth/callback), read the URL params and verify:

React Usage

Login Component

When the user clicks “Send Magic Link”, the component shows a confirmation message: “Magic link sent to user@example.com. Check your inbox.”

Callback Component

Mount <StewardEmailCallback> on your callback route to handle token verification automatically:
The component reads token and email from the URL search params, calls verifyEmailCallback, and shows loading/success/error states.

Server Configuration

To enable email auth on a self-hosted instance:
Steward uses Resend for email delivery. Create a free account at resend.com and verify your sending domain. The free tier supports 100 emails/day.

Callback URL

The magic link directs users to:
Make sure your app has a route at /auth/callback that handles this. If you need a different path, configure EMAIL_CALLBACK_PATH in your environment.

API Endpoints

Security

  • The shared link and code expire after 10 minutes
  • Link and code are one atomic challenge: either can win exactly once
  • Link tokens and polling secrets are cryptographically random (32 bytes)
  • Link tokens are SHA-256 hashed and codes use keyed HMAC at rest
  • Five wrong code attempts hard-lock the challenge; API and destination rate limits also apply
  • Polling is status-only so an unsolicited magic-link click cannot transfer a session to the requester