[PR #9022] feat(sso): expose organizationId in providersLimit function #16624

Open
opened 2026-04-13 10:36:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/9022
Author: @ping-maxwell
Created: 4/7/2026
Status: 🔄 Open

Base: nextHead: feat/sso-providers-limit-organization-id


📝 Commits (10+)

  • 60123da docs: add missing secret to getSignedCookie and remove misleading comments (#9008)
  • 3baf029 chore(docs): add remark-frontmatter (#9015)
  • 374985e docs: update community adapters and plugins pages (#9014)
  • 3b95d70 docs: change community plugin name (#8961)
  • 47dc887 docs: add @delmaredigital/payload-better-auth to community plugins (#8375)
  • f61ad1c fix: use INVALID_PASSWORD for all checkPassword failures (#8902)
  • e0f2937 feat(sso): expose organizationId in providersLimit function
  • ffdc982 chore: change markdown lines back
  • 43346c9 chore: revert all markdown lines in 1.3
  • d1eaa84 chore: changeset

📊 Changes

17 files changed (+1060 additions, -703 deletions)

View changed files

.changeset/pr-8902.md (+5 -0)
.changeset/pr-9022.md (+5 -0)
📝 docs/.remarkrc.mjs (+2 -0)
📝 docs/components/community-plugins-table.tsx (+13 -2)
📝 docs/content/blogs/1-3.mdx (+15 -18)
📝 docs/content/docs/adapters/community-adapters.mdx (+8 -3)
📝 docs/content/docs/concepts/hooks.mdx (+1 -1)
📝 docs/content/docs/integrations/next.mdx (+1 -7)
📝 docs/content/docs/plugins/community-plugins.mdx (+3 -3)
📝 docs/content/docs/plugins/sso.mdx (+679 -656)
📝 docs/package.json (+2 -1)
📝 packages/better-auth/src/plugins/two-factor/two-factor.test.ts (+72 -0)
📝 packages/better-auth/src/utils/password.ts (+8 -6)
📝 packages/sso/src/routes/sso.ts (+14 -2)
📝 packages/sso/src/saml.test.ts (+171 -2)
📝 packages/sso/src/types.ts (+9 -2)
📝 pnpm-lock.yaml (+52 -0)

📄 Description

Summary

  • Changed the providersLimit function signature from (user: User) => number to ({ user, organizationId }) => number, allowing organization-specific SSO provider limits
  • The organizationId from the request body is now passed through when registering an SSO provider, enabling plan-based validation per organization

Tests

  • Added regression test verifying organizationId is passed to providersLimit
  • Existing providersLimit tests pass with updated signature
  • Type check passes Closes #7750

🔄 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/9022 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 4/7/2026 **Status:** 🔄 Open **Base:** `next` ← **Head:** `feat/sso-providers-limit-organization-id` --- ### 📝 Commits (10+) - [`60123da`](https://github.com/better-auth/better-auth/commit/60123da09ce09996782a30995a8a13bf6ce0274f) docs: add missing secret to getSignedCookie and remove misleading comments (#9008) - [`3baf029`](https://github.com/better-auth/better-auth/commit/3baf0294c2e439714fdf926977ea2cf4aed06539) chore(docs): add `remark-frontmatter` (#9015) - [`374985e`](https://github.com/better-auth/better-auth/commit/374985e340643f230adeb30961a76b414af6cb7c) docs: update community adapters and plugins pages (#9014) - [`3b95d70`](https://github.com/better-auth/better-auth/commit/3b95d70d046164424f778b4c01ba17319c2eaae5) docs: change community plugin name (#8961) - [`47dc887`](https://github.com/better-auth/better-auth/commit/47dc887d589d75d486edbd34b5cff869cb48194e) docs: add `@delmaredigital/payload-better-auth` to community plugins (#8375) - [`f61ad1c`](https://github.com/better-auth/better-auth/commit/f61ad1cab7360e4460e6450904e97498298a79d5) fix: use `INVALID_PASSWORD` for all `checkPassword` failures (#8902) - [`e0f2937`](https://github.com/better-auth/better-auth/commit/e0f293704ab35d246943db044f5784f5aa00074f) feat(sso): expose organizationId in providersLimit function - [`ffdc982`](https://github.com/better-auth/better-auth/commit/ffdc9826029735a2b2ef5fe5720e491fd82ba145) chore: change markdown lines back - [`43346c9`](https://github.com/better-auth/better-auth/commit/43346c937cf0223d209aa22c99b763f41a121c36) chore: revert all markdown lines in 1.3 - [`d1eaa84`](https://github.com/better-auth/better-auth/commit/d1eaa84f0246db1f98919b2c7ca0869b672aeb03) chore: changeset ### 📊 Changes **17 files changed** (+1060 additions, -703 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/pr-8902.md` (+5 -0) ➕ `.changeset/pr-9022.md` (+5 -0) 📝 `docs/.remarkrc.mjs` (+2 -0) 📝 `docs/components/community-plugins-table.tsx` (+13 -2) 📝 `docs/content/blogs/1-3.mdx` (+15 -18) 📝 `docs/content/docs/adapters/community-adapters.mdx` (+8 -3) 📝 `docs/content/docs/concepts/hooks.mdx` (+1 -1) 📝 `docs/content/docs/integrations/next.mdx` (+1 -7) 📝 `docs/content/docs/plugins/community-plugins.mdx` (+3 -3) 📝 `docs/content/docs/plugins/sso.mdx` (+679 -656) 📝 `docs/package.json` (+2 -1) 📝 `packages/better-auth/src/plugins/two-factor/two-factor.test.ts` (+72 -0) 📝 `packages/better-auth/src/utils/password.ts` (+8 -6) 📝 `packages/sso/src/routes/sso.ts` (+14 -2) 📝 `packages/sso/src/saml.test.ts` (+171 -2) 📝 `packages/sso/src/types.ts` (+9 -2) 📝 `pnpm-lock.yaml` (+52 -0) </details> ### 📄 Description ## Summary - Changed the `providersLimit` function signature from `(user: User) => number` to `({ user, organizationId }) => number`, allowing organization-specific SSO provider limits - The `organizationId` from the request body is now passed through when registering an SSO provider, enabling plan-based validation per organization ## Tests - [x] Added regression test verifying `organizationId` is passed to `providersLimit` - [x] Existing `providersLimit` tests pass with updated signature - [x] Type check passes Closes #7750 --- <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 10:36:54 -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#16624