[PR #6099] feat(email-otp): username sign-in #23345

Open
opened 2026-04-15 21:38:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6099
Author: @Blackmamoth
Created: 11/19/2025
Status: 🔄 Open

Base: mainHead: feat/email-otp-username-signin


📝 Commits (4)

  • 635309e feat(email-otp): add username sign in
  • 5ad0151 docs: add examples for username sign in with emailOTP plugin
  • 02abda5 apply linting and formatting
  • c241aee pass ctx to sendVerificationOTP

📊 Changes

3 files changed (+516 additions, -0 deletions)

View changed files

📝 docs/content/docs/plugins/email-otp.mdx (+36 -0)
📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+96 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+384 -0)

📄 Description

add username sign-in with emailOTP plugin

closes #4712


Summary by cubic

Adds username-based OTP sign-in to the email-otp plugin. Users can request an OTP by username and sign in with it, with validation and rate limits.

  • New Features

    • Added POST /email-otp/send-username-sign-in-otp and POST /sign-in/username-otp endpoints.
    • Supports username normalization/validation (length, allowed characters, custom validator) and auto-verifies email on success.
    • Uses a separate OTP namespace for usernames, with attempt limits and rate limiting.
  • Migration

    • Enable the username plugin.
    • If using the client, include emailOTPClient() and usernameClient().
    • No schema changes.

Written for commit c241aeeaf0. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6099 **Author:** [@Blackmamoth](https://github.com/Blackmamoth) **Created:** 11/19/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/email-otp-username-signin` --- ### 📝 Commits (4) - [`635309e`](https://github.com/better-auth/better-auth/commit/635309ee22346ab5ce8a4c9684c7807faf657c14) feat(email-otp): add username sign in - [`5ad0151`](https://github.com/better-auth/better-auth/commit/5ad01513d1e53e36eb403e2856f1151f937d3470) docs: add examples for username sign in with emailOTP plugin - [`02abda5`](https://github.com/better-auth/better-auth/commit/02abda5c2dbb8eaac05fce39423cee2889030544) apply linting and formatting - [`c241aee`](https://github.com/better-auth/better-auth/commit/c241aeeaf0c500215430322a280eaf7b300a7462) pass ctx to sendVerificationOTP ### 📊 Changes **3 files changed** (+516 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/email-otp.mdx` (+36 -0) 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+96 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+384 -0) </details> ### 📄 Description add username sign-in with emailOTP plugin closes #4712 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds username-based OTP sign-in to the email-otp plugin. Users can request an OTP by username and sign in with it, with validation and rate limits. - **New Features** - Added POST /email-otp/send-username-sign-in-otp and POST /sign-in/username-otp endpoints. - Supports username normalization/validation (length, allowed characters, custom validator) and auto-verifies email on success. - Uses a separate OTP namespace for usernames, with attempt limits and rate limiting. - **Migration** - Enable the username plugin. - If using the client, include emailOTPClient() and usernameClient(). - No schema changes. <sup>Written for commit c241aeeaf0c500215430322a280eaf7b300a7462. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 21:38:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#23345