Authentication email delivery with Own Auth
Own Auth creates the URL for each magic link, email verification, password reset, and organisation invitation. The configured email provider sends that URL. This guide uses Own Auth Delivery for authenticated requests, rate limits, queued sending, retries, and delivery events.
Connect Own Auth Delivery
Own Auth still creates, stores, and verifies each one-time token. baseUrl puts the application's public origin in every emailed auth URL. OwnAuthManagedEmailProvider sends that finished URL and the message details to Delivery.
import {
createOwnAuth,
OwnAuthManagedEmailProvider,
} from "own-auth";
const baseUrl = process.env.APP_URL!;
const deliveryKey = process.env.OWN_AUTH_EMAIL_DELIVERY_KEY!;
const tokenPepper = process.env.OWN_AUTH_TOKEN_PEPPER!;
export const auth = createOwnAuth({
tokenPepper,
baseUrl,
emailProvider: new OwnAuthManagedEmailProvider({
deliveryKey,
}),
});Authenticate, limit, and queue each send
Delivery authenticates the delivery key, validates the email type, recipient, and auth URL, then applies delivery-key, recipient, and application limits. A successful request is queued, recorded as accepted, and returns HTTP 202.
Report the delivery state
- Accepted: Delivery validated the request and queued the message.
- Delivered: the recipient server accepted the message.
- Failed: the message hit a permanent failure or exhausted its retries.
Delivery retries temporary sender failures up to three times. Permanent failures fail immediately. Suppressed recipients are rejected before the message enters the queue.