[PR #7722] [MERGED] fix(sso): allow custom organization roles in provisioning types #33115

Closed
opened 2026-04-17 23:47:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7722
Author: @MuzzaiyyanHussain
Created: 1/31/2026
Status: Merged
Merged: 2/2/2026
Merged by: @himself65

Base: canaryHead: fix/sso-custom-org-roles


📝 Commits (1)

  • 72c8679 fix(sso): allow custom organization roles in provisioning types

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 packages/sso/src/linking/org-assignment.ts (+2 -2)

📄 Description

Problem

The SSO plugin currently restricts organization role assignment to "member" | "admin" at the TypeScript level.
This contradicts:

  • The Organization plugin schema, which defines roles as arbitrary strings
  • Existing runtime behavior, which already supports custom roles
  • Documentation describing custom role provisioning with SSO

As a result, using custom organization roles in SSO flows requires unsafe type assertions.

Solution

  • Widen getRole return type to Promise<string>
  • Widen defaultRole to string

This aligns SSO plugin types with actual runtime behavior and documentation, without changing any logic.

Notes

  • This is a type-only change
  • No runtime behavior is modified
  • Role validation remains handled by the Organization plugin schema
  • Existing usages remain fully compatible

fixes #7719


Summary by cubic

Allow custom organization roles in SSO provisioning by widening defaultRole and getRole from "member" | "admin" to string. Aligns types with the Organization schema and current behavior; no logic changes (fixes #7719).

Written for commit 72c8679251. 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/7722 **Author:** [@MuzzaiyyanHussain](https://github.com/MuzzaiyyanHussain) **Created:** 1/31/2026 **Status:** ✅ Merged **Merged:** 2/2/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/sso-custom-org-roles` --- ### 📝 Commits (1) - [`72c8679`](https://github.com/better-auth/better-auth/commit/72c8679251c467a01c10b4fbbc44c5af2c4bac43) fix(sso): allow custom organization roles in provisioning types ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/linking/org-assignment.ts` (+2 -2) </details> ### 📄 Description ### Problem The SSO plugin currently restricts organization role assignment to `"member" | "admin"` at the TypeScript level. This contradicts: - The Organization plugin schema, which defines roles as arbitrary strings - Existing runtime behavior, which already supports custom roles - Documentation describing custom role provisioning with SSO As a result, using custom organization roles in SSO flows requires unsafe type assertions. ### Solution - Widen `getRole` return type to `Promise<string>` - Widen `defaultRole` to `string` This aligns SSO plugin types with actual runtime behavior and documentation, without changing any logic. ### Notes - This is a type-only change - No runtime behavior is modified - Role validation remains handled by the Organization plugin schema - Existing usages remain fully compatible fixes #7719 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Allow custom organization roles in SSO provisioning by widening defaultRole and getRole from "member" | "admin" to string. Aligns types with the Organization schema and current behavior; no logic changes (fixes #7719). <sup>Written for commit 72c8679251c467a01c10b4fbbc44c5af2c4bac43. 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-17 23:47:08 -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#33115