[GH-ISSUE #5435] Before/After hooks for leaveOrganization #18874

Open
opened 2026-04-15 17:33:47 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @liri2006 on GitHub (Oct 20, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5435

Originally assigned to: @ping-maxwell on GitHub.

Is this suited for github?

  • Yes, this is suited for github

I'm implementing organizations in my app and noticed that there are no hooks for leaving the organization. Thought that maybe hooks for removeMember will fire, but sadly that is not the case.

Describe the solution you'd like

It would be great to have a possibility to cleanup some user data using before/after hooks for leaveOrganization same way as it works for removeMember.

Describe alternatives you've considered

Call cleanup logic where api.leaveOrganization is called. But it leads to logic fragmentation, as some lives in organizations config and some is server logic folder.

Additional context

No response

Originally created by @liri2006 on GitHub (Oct 20, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5435 Originally assigned to: @ping-maxwell on GitHub. ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I'm implementing organizations in my app and noticed that there are no hooks for leaving the organization. Thought that maybe hooks for removeMember will fire, but sadly that is not the case. ### Describe the solution you'd like It would be great to have a possibility to cleanup some user data using before/after hooks for leaveOrganization same way as it works for removeMember. ### Describe alternatives you've considered Call cleanup logic where api.leaveOrganization is called. But it leads to logic fragmentation, as some lives in organizations config and some is server logic folder. ### Additional context _No response_
GiteaMirror added the organization label 2026-04-15 17:33:47 -05:00
Author
Owner

@GautamBytes commented on GitHub (Oct 26, 2025):

Working on it , expect a pr soon!

<!-- gh-comment-id:3448092268 --> @GautamBytes commented on GitHub (Oct 26, 2025): Working on it , expect a pr soon!
Author
Owner

@dosubot[bot] commented on GitHub (Jan 25, 2026):

Hi, @liri2006. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested before/after hooks for the leaveOrganization action to centralize user data cleanup.
  • Currently, leaving an organization triggers no hooks, causing fragmented cleanup logic.
  • Maintainer GautamBytes is actively working on this feature and has promised a pull request soon.
  • The issue remains unresolved as the feature is not yet merged or released.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of better-auth by commenting here.
  • If I don’t hear back within 7 days, this issue will be automatically closed.

Thanks for your understanding and contribution!

<!-- gh-comment-id:3796882026 --> @dosubot[bot] commented on GitHub (Jan 25, 2026): Hi, @liri2006. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested before/after hooks for the leaveOrganization action to centralize user data cleanup. - Currently, leaving an organization triggers no hooks, causing fragmented cleanup logic. - Maintainer GautamBytes is actively working on this feature and has promised a pull request soon. - The issue remains unresolved as the feature is not yet merged or released. **Next Steps:** - Please let me know if this issue is still relevant to the latest version of better-auth by commenting here. - If I don’t hear back within 7 days, this issue will be automatically closed. Thanks for your understanding and contribution!
Author
Owner

@liri2006 commented on GitHub (Feb 4, 2026):

This issue is still relevant. Please reopen.

<!-- gh-comment-id:3846510838 --> @liri2006 commented on GitHub (Feb 4, 2026): This issue is still relevant. Please reopen.
Author
Owner

@dosubot[bot] commented on GitHub (Feb 4, 2026):

@Bekacru The user liri2006 has indicated that this issue is still relevant and requests it to be reopened. Could you please take a look and assist?

<!-- gh-comment-id:3846520961 --> @dosubot[bot] commented on GitHub (Feb 4, 2026): @Bekacru The user liri2006 has indicated that this issue is still relevant and requests it to be reopened. Could you please take a look and assist?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#18874