Skip to main content

Type Alias: EmailAuthOptions

EmailAuthOptions = object

Defined in: auth-core/src/emailAuthTypes.ts:305

Properties

baseUrl?

optional baseUrl?: string

Defined in: auth-core/src/emailAuthTypes.ts:329

Absolute base URL of the application the emailed links point at, e.g. https://app.example.com. Required by every mode except emailCode.


emailCode?

optional emailCode?: EmailCodeOptions

Defined in: auth-core/src/emailAuthTypes.ts:341


hooks?

optional hooks?: EmailAuthHooks

Defined in: auth-core/src/emailAuthTypes.ts:344


issueSession

issueSession: (user) => Promise<EmailAuthSession> | EmailAuthSession

Defined in: auth-core/src/emailAuthTypes.ts:316

Mints whatever the application calls a session. Kept as a hook rather than a built-in because session topology is the one thing consumers genuinely disagree on — a long-lived JWT and a short access token with a rotating refresh family are both valid, and neither belongs in this engine.

Parameters

ParameterType
userEmailAuthUser

Returns

Promise<EmailAuthSession> | EmailAuthSession


linkPaths?

optional linkPaths?: object

Defined in: auth-core/src/emailAuthTypes.ts:335

Client-side paths the emailed links land on, appended to baseUrl with ?token=. Default to /auth/callback, /auth/verify-email and /auth/reset-password.

emailVerification?

optional emailVerification?: string

optional magicLink?: string

passwordReset?

optional passwordReset?: string


modes

modes: EmailAuthMode[]

Defined in: auth-core/src/emailAuthTypes.ts:307

The flows to enable. At least one is required.


oneTimeTokenStore

oneTimeTokenStore: OneTimeTokenStore

Defined in: auth-core/src/emailAuthTypes.ts:309


password?

optional password?: PasswordOptions

Defined in: auth-core/src/emailAuthTypes.ts:342


paths?

optional paths?: EmailAuthPaths

Defined in: auth-core/src/emailAuthTypes.ts:343


requestRateLimit?

optional requestRateLimit?: RequestRateLimit

Defined in: auth-core/src/emailAuthTypes.ts:355

Caps how often one address can be mailed. Strongly recommended: without it the send endpoints will mail any address as fast as they are called.

The cap is applied to the request, before the engine looks the address up, and every request is recorded whether or not mail followed. That is deliberate — counting only the requests that produced mail would make a 429 mean "this address has an account", turning the limiter into the enumeration oracle the rest of the flow is careful to avoid.


sendEmail

sendEmail: (delivery) => Promise<void> | void

Defined in: auth-core/src/emailAuthTypes.ts:324

Sends one auth email. Anything it throws propagates out of the handler to the adapter's error handling rather than being folded into a response, so a delivery outage surfaces as an error the application already reports.

Parameters

ParameterType
deliveryEmailAuthDelivery

Returns

Promise<void> | void


ttl?

optional ttl?: EmailAuthTtl

Defined in: auth-core/src/emailAuthTypes.ts:340


userStore

userStore: EmailAuthUserStore

Defined in: auth-core/src/emailAuthTypes.ts:308