[PR #4005] [MERGED] feat(email-otp): add rateLimit configuration option #13378

Closed
opened 2026-04-13 08:53:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4005
Author: @ShobhitPatra
Created: 8/14/2025
Status: Merged
Merged: 2/4/2026
Merged by: @himself65

Base: canaryHead: feat/email-otp


📝 Commits (4)

  • 86de6fb feat(email-otp): add rateLimit configuration option
  • a868425 Update packages/better-auth/src/plugins/email-otp/index.ts
  • 73ae26c chore(email-otp): fix linting issues
  • 7366af4 fix: lint

📊 Changes

2 files changed (+26 additions, -14 deletions)

View changed files

📝 packages/better-auth/src/plugins/email-otp/index.ts (+14 -14)
📝 packages/better-auth/src/plugins/email-otp/types.ts (+12 -0)

📄 Description

Closes issue https://github.com/better-auth/better-auth/issues/3848

Summary

Adds rateLimit configuration option to the emailOtp plugin, similar to the magicLink plugin.

Changes

  • Added rateLimit option to EmailOtpOptions
  • Applied rateLimit rule for all /email-otp endpoints

Example Usage

emailOtp({
  sendVerificationOTP: async ({ email, otp }) => {
    //code
  },
  rateLimit: {
    window: 60, // seconds
    max: 3,     // requests per window
  }
})

    

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Added a rateLimit configuration to the emailOtp plugin so developers can set custom limits on requests for all email-otp endpoints, matching the behavior of magicLink.

- **New Feature**
  - Added rateLimit option to EmailOTPOptions with configurable window and max values (defaults: 60s window, 3 requests).

<sup>Written for commit 7366af466065c4f3a33ff5631441e0cd6d666a54. Summary will update 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>
## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4005 **Author:** [@ShobhitPatra](https://github.com/ShobhitPatra) **Created:** 8/14/2025 **Status:** ✅ Merged **Merged:** 2/4/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/email-otp` --- ### 📝 Commits (4) - [`86de6fb`](https://github.com/better-auth/better-auth/commit/86de6fb3d7df944cf594653a8434bc0278cc454e) feat(email-otp): add rateLimit configuration option - [`a868425`](https://github.com/better-auth/better-auth/commit/a868425ff3ea146adaf9bd367402567211e25a35) Update packages/better-auth/src/plugins/email-otp/index.ts - [`73ae26c`](https://github.com/better-auth/better-auth/commit/73ae26c3973b9f07bfd1ee03c227146881f04915) chore(email-otp): fix linting issues - [`7366af4`](https://github.com/better-auth/better-auth/commit/7366af466065c4f3a33ff5631441e0cd6d666a54) fix: lint ### 📊 Changes **2 files changed** (+26 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+14 -14) 📝 `packages/better-auth/src/plugins/email-otp/types.ts` (+12 -0) </details> ### 📄 Description ## Related Issue Closes issue https://github.com/better-auth/better-auth/issues/3848 ## Summary Adds `rateLimit` configuration option to the `emailOtp` plugin, similar to the `magicLink` plugin. ## Changes - Added `rateLimit` option to `EmailOtpOptions` - Applied rateLimit rule for all `/email-otp` endpoints ## Example Usage ```ts emailOtp({ sendVerificationOTP: async ({ email, otp }) => { //code }, rateLimit: { window: 60, // seconds max: 3, // requests per window } }) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added a rateLimit configuration to the emailOtp plugin so developers can set custom limits on requests for all email-otp endpoints, matching the behavior of magicLink. - **New Feature** - Added rateLimit option to EmailOTPOptions with configurable window and max values (defaults: 60s window, 3 requests). <sup>Written for commit 7366af466065c4f3a33ff5631441e0cd6d666a54. Summary will update 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-13 08:53:45 -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#13378