[PR #7666] [MERGED] feat(oauth-provider): add configurable rate limiting for OAuth endpoints #7479

Closed
opened 2026-03-13 13:38:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7666
Author: @Paola3stefania
Created: 1/28/2026
Status: Merged
Merged: 1/29/2026
Merged by: @Bekacru

Base: canaryHead: feat/oauth-provider-rate-limiting


📝 Commits (2)

📊 Changes

4 files changed (+427 additions, -0 deletions)

View changed files

📝 docs/content/docs/plugins/oauth-provider.mdx (+53 -0)
📝 packages/oauth-provider/src/oauth.test.ts (+262 -0)
📝 packages/oauth-provider/src/oauth.ts (+62 -0)
📝 packages/oauth-provider/src/types/index.ts (+50 -0)

📄 Description

Summary by cubic

Adds configurable, per-IP rate limiting for all OAuth endpoints to protect against abuse. Defaults are sensible, and you can customize or disable limits per endpoint.

  • New Features
    • Per-IP, per-endpoint limits for /oauth2/token, /oauth2/authorize, /oauth2/introspect, /oauth2/revoke, /oauth2/register, and /oauth2/userinfo.
    • Defaults: token 20/min, authorize 30/min, introspect 100/min, revoke 30/min, register 5/min, userinfo 60/min.
    • Configure via oauthProvider({ rateLimit: { ... } }) with window (seconds) and max. Set an endpoint to false to disable.
    • Enforcement applies only when Better Auth’s global rate limiter is enabled.

Written for commit 3c2fdc1c6d. Summary will update 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/7666 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 1/28/2026 **Status:** ✅ Merged **Merged:** 1/29/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/oauth-provider-rate-limiting` --- ### 📝 Commits (2) - [`9c496c2`](https://github.com/better-auth/better-auth/commit/9c496c22aaeed339785d3fd78402b7b0bc745d21) feat: rate limit - [`3c2fdc1`](https://github.com/better-auth/better-auth/commit/3c2fdc1c6df1d2cd3f62a71307fb275e6ce57a4a) fix docs ### 📊 Changes **4 files changed** (+427 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/oauth-provider.mdx` (+53 -0) 📝 `packages/oauth-provider/src/oauth.test.ts` (+262 -0) 📝 `packages/oauth-provider/src/oauth.ts` (+62 -0) 📝 `packages/oauth-provider/src/types/index.ts` (+50 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds configurable, per-IP rate limiting for all OAuth endpoints to protect against abuse. Defaults are sensible, and you can customize or disable limits per endpoint. - **New Features** - Per-IP, per-endpoint limits for `/oauth2/token`, `/oauth2/authorize`, `/oauth2/introspect`, `/oauth2/revoke`, `/oauth2/register`, and `/oauth2/userinfo`. - Defaults: token 20/min, authorize 30/min, introspect 100/min, revoke 30/min, register 5/min, userinfo 60/min. - Configure via `oauthProvider({ rateLimit: { ... } })` with `window` (seconds) and `max`. Set an endpoint to `false` to disable. - Enforcement applies only when Better Auth’s global rate limiter is enabled. <sup>Written for commit 3c2fdc1c6df1d2cd3f62a71307fb275e6ce57a4a. 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-03-13 13:38:11 -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#7479