[GH-ISSUE #9184] tracking: organization invitations (validation, race conditions, channels) #19933

Open
opened 2026-04-15 19:18:20 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @gustavovalverde on GitHub (Apr 14, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/9184

Summary

Invitation handling in the organization plugin breaks in validation, acceptance, and delivery flows. Invite creation allows inconsistent role state. acceptInvitation does not protect against concurrent acceptance. The plugin also lacks a first-class channel model for non-email delivery. Onboarding and bulk invite flows remain incomplete.

Root cause

The invite endpoints pre-date the current role and enrollment surfaces. Validation does not fully enforce role state constraints, and acceptance does not perform one atomic race check. The transport model also treats the recipient as an email address instead of separating channel from identifier. Unauthenticated invite acceptance does not have one defined onboarding path. Bulk and filtered operations exist lower in the stack but are not exposed consistently through the API.

Scope

In: invite validation, acceptInvitation atomicity, channel abstraction (email + phone + custom), unauthenticated recipient onboarding, listInvitations filtering, bulk invite.

Out: dynamic-role typing surface (tracking: admin/org dynamic-role lifecycle). Super-admin cross-org scope (tracking: admin plugin scope + impersonation).

Resolution criteria

  • Invite validation rejects inconsistent role states on create.
  • acceptInvitation is atomic under concurrent accepts.
  • Invites dispatch via email, phone, or a custom channel through one config.
  • Unauthenticated recipients can accept an invite and complete onboarding in the same flow.
  • listInvitations supports filtering.
  • Bulk invite API exists.
  • Dynamic-role invite typing bug #9135 was moved to the dynamic-role lifecycle tracker because the root cause is in the role system, not the invite path.
  • Prior closed context: #6710, #6598, #8691, #7824, #7820, #6576, #7291, #8385.
Originally created by @gustavovalverde on GitHub (Apr 14, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/9184 ## Summary Invitation handling in the organization plugin breaks in validation, acceptance, and delivery flows. Invite creation allows inconsistent role state. `acceptInvitation` does not protect against concurrent acceptance. The plugin also lacks a first-class channel model for non-email delivery. Onboarding and bulk invite flows remain incomplete. ## Root cause The invite endpoints pre-date the current role and enrollment surfaces. Validation does not fully enforce role state constraints, and acceptance does not perform one atomic race check. The transport model also treats the recipient as an email address instead of separating channel from identifier. Unauthenticated invite acceptance does not have one defined onboarding path. Bulk and filtered operations exist lower in the stack but are not exposed consistently through the API. ## Scope **In:** invite validation, `acceptInvitation` atomicity, channel abstraction (email + phone + custom), unauthenticated recipient onboarding, listInvitations filtering, bulk invite. **Out:** dynamic-role typing surface (`tracking: admin/org dynamic-role lifecycle`). Super-admin cross-org scope (`tracking: admin plugin scope + impersonation`). ## Resolution criteria - Invite validation rejects inconsistent role states on create. - `acceptInvitation` is atomic under concurrent accepts. - Invites dispatch via email, phone, or a custom channel through one config. - Unauthenticated recipients can accept an invite and complete onboarding in the same flow. - `listInvitations` supports filtering. - Bulk invite API exists. ## Related - Dynamic-role invite typing bug #9135 was moved to the dynamic-role lifecycle tracker because the root cause is in the role system, not the invite path. - Prior closed context: #6710, #6598, #8691, #7824, #7820, #6576, #7291, #8385.
GiteaMirror added the trackingenhancementorganization labels 2026-04-15 19:18:20 -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#19933