[PR #6841] [CLOSED] chore(better-auth): add context to organization hooks #23816

Closed
opened 2026-04-15 21:59:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6841
Author: @jonathansamines
Created: 12/17/2025
Status: Closed

Base: canaryHead: feat/add-context-to-organization-hooks


📝 Commits (2)

  • 89fb179 chore(better-auth): add context to organization hooks
  • 5ae178b chore(better-auth): update inline organization hooks examples

📊 Changes

8 files changed (+747 additions, -443 deletions)

View changed files

📝 docs/content/docs/plugins/organization.mdx (+32 -32)
📝 packages/better-auth/src/plugins/organization/routes/crud-invites.ts (+58 -36)
📝 packages/better-auth/src/plugins/organization/routes/crud-members.test.ts (+72 -3)
📝 packages/better-auth/src/plugins/organization/routes/crud-members.ts (+55 -36)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.test.ts (+59 -18)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+82 -52)
📝 packages/better-auth/src/plugins/organization/routes/crud-team.ts (+98 -65)
📝 packages/better-auth/src/plugins/organization/types.ts (+291 -201)

📄 Description

Summary by cubic

Add endpoint context (ctx) to all organization hooks so custom logic can access request/session details. Updated types, routes, docs, and tests to pass ctx consistently.

  • New Features

    • All organization hooks now receive ctx: GenericEndpointContext.
    • Routes for orgs, members, teams, and invites pass ctx to before/after hooks; docs and tests updated.
  • Migration

    • Update your organizationHooks to use (data, ctx) for every hook.
    • If using TypeScript, add ctx: GenericEndpointContext to hook signatures.

Written for commit 5ae178be5a. Summary will update automatically 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/6841 **Author:** [@jonathansamines](https://github.com/jonathansamines) **Created:** 12/17/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/add-context-to-organization-hooks` --- ### 📝 Commits (2) - [`89fb179`](https://github.com/better-auth/better-auth/commit/89fb179fd38438270390ed26b7c757b51385384c) chore(better-auth): add context to organization hooks - [`5ae178b`](https://github.com/better-auth/better-auth/commit/5ae178be5a474938564b708639be1b62eeb28d7c) chore(better-auth): update inline organization hooks examples ### 📊 Changes **8 files changed** (+747 additions, -443 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/organization.mdx` (+32 -32) 📝 `packages/better-auth/src/plugins/organization/routes/crud-invites.ts` (+58 -36) 📝 `packages/better-auth/src/plugins/organization/routes/crud-members.test.ts` (+72 -3) 📝 `packages/better-auth/src/plugins/organization/routes/crud-members.ts` (+55 -36) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.test.ts` (+59 -18) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+82 -52) 📝 `packages/better-auth/src/plugins/organization/routes/crud-team.ts` (+98 -65) 📝 `packages/better-auth/src/plugins/organization/types.ts` (+291 -201) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Add endpoint context (ctx) to all organization hooks so custom logic can access request/session details. Updated types, routes, docs, and tests to pass ctx consistently. - **New Features** - All organization hooks now receive ctx: GenericEndpointContext. - Routes for orgs, members, teams, and invites pass ctx to before/after hooks; docs and tests updated. - **Migration** - Update your organizationHooks to use (data, ctx) for every hook. - If using TypeScript, add ctx: GenericEndpointContext to hook signatures. <sup>Written for commit 5ae178be5a474938564b708639be1b62eeb28d7c. Summary will update automatically 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-15 21:59:59 -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#23816