Skip to content

feat: Add passwordless login to the email identity provider - #5828

Closed
SandPod wants to merge 11 commits into
mainfrom
cursor/passwordless-email-login-edc5
Closed

SandPod wants to merge 11 commits into
mainfrom
cursor/passwordless-email-login-edc5

Conversation

@SandPod

@SandPod SandPod commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds passwordless email login: users sign in with a 6-digit code sent to their email address. It is part of the existing email identity provider (EmailIdp), not a separate provider. The first successful code login signs up unknown addresses unless allowSignUp is false.

Fixes #2100

Changes

Server (serverpod_auth_idp_server)

  • EmailIdpConfig has two optional groups that can be enabled independently: password: EmailPasswordLoginConfig (default on) and passwordless: EmailPasswordlessLoginConfig (default off). At least one is required. Methods of a disabled login method fail with reason unknown.
  • EmailIdp / EmailIdpBaseEndpoint: new startPasswordlessLogin and finishPasswordlessLogin. EmailIdpAdmin: cleanup of login requests and attempts.
  • Code logins use the same EmailAccounts (accounts created this way have an empty password hash) and issue sessions with method email, so a password reset also revokes them.
  • ServerpodCloudEmailIdpConfig: new enablePasswordLogin / enablePasswordlessLogin and passwordless options.
  • New table serverpod_auth_idp_email_account_login_request (migration included).
  • Security hardening: codes are single use and attempt-limited, sends are rate-limited with a resend cooldown, and decoy requests stop the API revealing whether an account exists. The remaining limits are documented on EmailPasswordlessLoginConfig.

Flutter (serverpod_auth_idp_flutter)

  • EmailSignInWidget(loginMethods: EmailLoginMethods.password | passwordless | both). The default is password, so existing apps are unchanged.

Review notes

  • Commits are structured for review. Models, generated code and migrations are in separate commits from the implementation.
  • Commit 1 only extracts the Serverpod Cloud code sender; it is a refactor with no behaviour change.

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

Breaking changes

None for existing configurations. Deprecations and small behaviour changes:

  • The top-level password settings on EmailIdpConfig (sendRegistrationVerificationCode, failedLoginRateLimit, …) are deprecated in favour of password: EmailPasswordLoginConfig(...). Passing them still works. Their getters now return nullable values (null when password login is disabled).
  • EmailIdp now validates its config on creation. For example, a secretHashSaltLength below 8 is rejected at startup instead of failing at the first hash.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@SandPod
SandPod force-pushed the cursor/passwordless-email-login-edc5 branch from fc17247 to b353403 Compare October 13, 2026 19:30
SandPod and others added 11 commits October 13, 2026 21:33
…config

Moves the sending and logging of verification codes through Serverpod Cloud
into serverpod_cloud_code_sender.dart, so that it can be reused for the codes
of the passwordless login.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Adds the EmailAccountLoginRequest table for pending login requests and the
EmailPasswordlessLoginException returned to clients.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Users can log in with a verification code sent to their email address,
without a password (#2100). The first successful login signs up unknown
email addresses unless allowSignUp is disabled.

EmailIdpConfig gets two optional configuration groups, which can be
enabled independently:
- password: EmailPasswordLoginConfig, the registration, login and password
  reset with a password. Enabled by default.
- passwordless: EmailPasswordlessLoginConfig, the login with a code.
  Disabled by default.

The existing top-level password settings of EmailIdpConfig keep working as
deprecated pass-throughs to the password group. The methods of a disabled
login method fail with the unknown reason of their exception.

Both login methods use the same EmailAccounts (an account created by a
code login has no password) and issue sessions with the email method, so a
password reset revokes the sessions of code logins as well.

EmailIdp and EmailIdpBaseEndpoint get startPasswordlessLogin and
finishPasswordlessLogin, EmailIdpAdmin gets the cleanup of login requests
and attempts, and ServerpodCloudEmailIdpConfig can enable the passwordless
login with enablePasswordlessLogin.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
EmailSignInWidget takes loginMethods (password, passwordless or both).
EmailAuthController handles the passwordless start and verify screens,
including the resend cooldown of the server.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Also moves the auth test servers to the password group of EmailIdpConfig.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SandPod
SandPod force-pushed the cursor/passwordless-email-login-edc5 branch from b353403 to c7bd7cb Compare October 13, 2026 19:38
@SandPod SandPod changed the title feat: Add passwordless email login to the auth module feat: Add passwordless login to the email identity provider Oct 13, 2026
@SandPod SandPod closed this Oct 15, 2026
@SandPod
SandPod deleted the cursor/passwordless-email-login-edc5 branch October 15, 2026 18:22
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add email and random number authentication

1 participant