Add ctx to organization hooks #2801

Closed
opened 2026-03-13 10:21:08 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @mhamid3d on GitHub (Jan 31, 2026).

Is this suited for github?

  • Yes, this is suited for github

Describe the solution you'd like

The GenericEndpointContext is missing from the organization plugin hooks. It would extremely helpful if it was passed as there is no other way to get the context after that point:

			if (options?.organizationHooks?.afterCreateOrganization) {
				await options?.organizationHooks.afterCreateOrganization({
					organization,
					user,
					member,
					ctx, // Add endpoint ctx here!
				});
			}
Originally created by @mhamid3d on GitHub (Jan 31, 2026). ### Is this suited for github? - [x] Yes, this is suited for github ### Describe the solution you'd like The `GenericEndpointContext` is missing from the organization plugin hooks. It would extremely helpful if it was passed as there is no other way to get the context after that point: ```typescript if (options?.organizationHooks?.afterCreateOrganization) { await options?.organizationHooks.afterCreateOrganization({ organization, user, member, ctx, // Add endpoint ctx here! }); } ```
GiteaMirror added the plugin label 2026-03-13 10:21:08 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Jan 31, 2026):

The feature request to add the ctx (GenericEndpointContext) to the organization hooks has already been addressed. The recent changes ensure that all organization hooks now receive the ctx, which allows developers to access request/session details when needed. It's important to update your organization hooks to utilize (data, ctx) for all hooks as per this modification [1].

You may want to adjust your code to include ctx now that it is provided in the hooks, enhancing your ability to execute custom logic effectively. If you have any other inquiries about making use of ctx or need assistance with implementing these changes, feel free to ask!

Have you had any experience integrating this into your existing hooks, or do you need help with a specific implementation?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

@better-auth-agent[bot] commented on GitHub (Jan 31, 2026): The feature request to add the `ctx` (GenericEndpointContext) to the organization hooks has already been addressed. The recent changes ensure that all organization hooks now receive the `ctx`, which allows developers to access request/session details when needed. It's important to update your organization hooks to utilize `(data, ctx)` for all hooks as per this modification [[1]](https://github.com/better-auth/better-auth/pull/6841). You may want to adjust your code to include `ctx` now that it is provided in the hooks, enhancing your ability to execute custom logic effectively. If you have any other inquiries about making use of `ctx` or need assistance with implementing these changes, feel free to ask! Have you had any experience integrating this into your existing hooks, or do you need help with a specific implementation? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@mhamid3d commented on GitHub (Jan 31, 2026):

Thanks bot

@mhamid3d commented on GitHub (Jan 31, 2026): Thanks bot
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2801