[PR #4120] [MERGED] feat: add onInvitationAccepted callback for org invitations #5198

Closed
opened 2026-03-13 12:13:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4120
Author: @Kinfe123
Created: 8/21/2025
Status: Merged
Merged: 8/27/2025
Merged by: @himself65

Base: canaryHead: feat/add-invitation-accepted-callback


📝 Commits (4)

  • 1e01ca0 feat: add onInvitationAccepted callback for org invitations
  • b37156a lint
  • 76cc7cb docs
  • 62c4b2a Merge branch 'canary' into feat/add-invitation-accepted-callback

📊 Changes

4 files changed (+187 additions, -3 deletions)

View changed files

📝 docs/content/docs/plugins/organization.mdx (+32 -0)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+90 -1)
📝 packages/better-auth/src/plugins/organization/routes/crud-invites.ts (+30 -2)
📝 packages/better-auth/src/plugins/organization/types.ts (+35 -0)

📄 Description

closes #4109

Summary by cubic

Adds an onInvitationAccepted callback to the organization plugin, triggered when a member accepts an invite. This enables custom hooks like notifications, analytics, or audit logs.

  • New Features
    • New OrganizationOptions.onInvitationAccepted(data, request) callback.
    • Called after a successful acceptInvitation, with: id, role, organization, invitation, inviter (member + user), acceptedUser.
    • Tests verify the callback fires once with the expected payload.

🔄 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/4120 **Author:** [@Kinfe123](https://github.com/Kinfe123) **Created:** 8/21/2025 **Status:** ✅ Merged **Merged:** 8/27/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/add-invitation-accepted-callback` --- ### 📝 Commits (4) - [`1e01ca0`](https://github.com/better-auth/better-auth/commit/1e01ca092bcf3352264dc3c2a01b34c922e7f216) feat: add onInvitationAccepted callback for org invitations - [`b37156a`](https://github.com/better-auth/better-auth/commit/b37156ab937fe12ec49b05bcc6a1cf03cb7129d0) lint - [`76cc7cb`](https://github.com/better-auth/better-auth/commit/76cc7cbe04ebb8264fc8fb779805954198872ded) docs - [`62c4b2a`](https://github.com/better-auth/better-auth/commit/62c4b2a079c8b45660b9cddbea70558cd111e389) Merge branch 'canary' into feat/add-invitation-accepted-callback ### 📊 Changes **4 files changed** (+187 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/organization.mdx` (+32 -0) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+90 -1) 📝 `packages/better-auth/src/plugins/organization/routes/crud-invites.ts` (+30 -2) 📝 `packages/better-auth/src/plugins/organization/types.ts` (+35 -0) </details> ### 📄 Description closes #4109 <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds an onInvitationAccepted callback to the organization plugin, triggered when a member accepts an invite. This enables custom hooks like notifications, analytics, or audit logs. - **New Features** - New OrganizationOptions.onInvitationAccepted(data, request) callback. - Called after a successful acceptInvitation, with: id, role, organization, invitation, inviter (member + user), acceptedUser. - Tests verify the callback fires once with the expected payload. <!-- 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 12:13: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#5198