v0.37.0¶
Release Date: 2026-11-25
SystemAuth can sign people in with a one-time code mailed to them. It needs
no account at an upstream provider, so an application can launch without
waiting for a GitHub or Google app to be reviewed, and every application that
federates to SystemAuth gets it with no code of its own. The login page
component in @plexusone/pages offers it as a Continue with email button.
Sign in with a mailed code¶
social_login.email. A person enters an address on SystemAuth's sign-in page, receives a numeric code, and types it in the same browser. A correct code signs them in. An empty section (email: {}) turns it on with the defaults; the section needsmailand no GitHub or Google provider.- Settings.
code_length(6 to 10 digits, default 6),code_lifetime(5 to 30 minutes, default 10) andmax_attempts(3 to 10 entries, default 5), each validated, in the configuration schema. - The same account model as social login. A proven code resolves to the
account for that address, creating it or reaching an existing one with the
same verified address, so the sign-up age question, invite codes and the
waitlist, consent and the session all apply. Routes:
/login/email,/login/email/codeand/login/email/code/resend; the sign-in page lists Email, andidp_hint=emailskips it. - Mail through omnimail. Codes go out through the same
mailsection andomnimail.Senderas verification links, so the provider is configuration. Sending Mail with Resend is new: its SMTP service works today withmail.provider: smtp.
See Sign In with an Email Code and the how-to guide.
What protects the code¶
A six-digit code can be guessed, so the controls carry the security:
- Tries. A code accepts
max_attemptsentries and then stops working. Each entry is counted before it is compared, in one atomic step, so parallel guesses cannot exceed the limit on any number of instances. - Guesses per address. A message the address limit suppresses leaves a code no entry can match, so the mail limits also bound the live codes for an address: 25 guesses per full quota of five messages at the defaults.
- One browser, stored keyed. A code works only in the browser that asked
for it, and is kept as an HMAC under a key derived from
tokens.hmac_secret, never in the clear. - A replaced code is dead. A resend replaces the earlier code, even when an entry for the earlier one is already in flight.
- No account disclosure. Asking for a code looks up no account.
- A changed address retires the old one. Changing an account's email now
also unlinks its
emailsign-in identity in the same transaction, so the old mailbox no longer reaches the account; GitHub and Google identities stay. An email identity that names an address the account no longer uses is refused.
For applications¶
- BFF.
/bff/auth/emailstarts the sign-in withidp_hint=email. A deployment without email sign-in lands on SystemAuth's sign-in page. - Web.
@plexusone/authadds theSignInMethodtype (an OAuth provider oremail) and@plexusone/pages'LoginPageacceptsemailinoauthProviders. Deploy this release first, then addemailto a page: an older BFF answersUNKNOWN_PROVIDER. - The application never receives the code; it receives the verified address afterward as identity data, as for any provider.
Operating it¶
- Security events.
systemauth.email_code.sent(whether it was sent) andsystemauth.email_code.exhausted(a code used up its tries, which repeated is what guessing looks like), mapped to OCSF Authentication events. Refusals and successes usesystemauth.sign_inwith methodemailand reasonscode_mismatch,code_unusableandstale_email_identity. No event holds a code or an address. - Limits. Code entries are limited to 20 a minute per client address
(
DefaultEmailCodeSubmitLimit), beside the mail send limitsper_addressandper_client. - Resend's free plan allows 100 messages a day and 3,000 a month, and every code is a message. Choose a plan from the sign-ins you expect.
Also in this release¶
- API.
systemauth.EmailLoginConfig,EmailLoginPath,EmailCodePath,EmailCodeResendPath,EventEmailCodeSent,EventEmailCodeExhaustedand the limits' defaults; thesign_in_codepurpose of verification tokens. - Dependencies. Updated, with the
godirective kept at 1.26.10.
Breaking changes¶
systemauth.VerificationTokenStoregains two methods,RecordAttemptandConsumeToken. The memory and Ent stores have them. A host with its own store must implement them;storetest.VerificationTokenStorechecks both, including the same-instant ordering that issue order must give.PrincipalEmailChanger.ChangeEmailalso unlinks the principal'semailidentities. The built-in directories do. A host's own implementation should do the same, or the old address keeps working for email sign-in.
Nothing else changes for a deployment that does not set social_login.email.
Upgrading¶
Add the new column. Run systemauth migrate (or start with --migrate); it
works on PostgreSQL and SQLite and is the route for any database from before
sf_verification_tokens existed. Alternatively, apply
migrations/0013_verification_token_attempts.sql to a PostgreSQL database that
already has sf_verification_tokens and every earlier migration (it is
PostgreSQL syntax and adds one column). A fresh database needs nothing. Without
the column, reading or writing a verification token fails.
To turn email sign-in on:
social_login:
email: {}
mail:
provider: smtp
from: "Example <[email protected]>"
smtp:
host: smtp.resend.com
port: 465
security: tls
username: resend
password: ${SYSTEMAUTH_SMTP_PASSWORD}
tokens:
hmac_secret: ${SYSTEMAUTH_HMAC_SECRET} # required in production
Production refuses the log mail provider. Before launch, run the
delivery check from the
production domain.