[GH-ISSUE #5187] Plugin Type Change #10182

Closed
opened 2026-04-13 06:09:23 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @R5dan on GitHub (Oct 9, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5187

Is this suited for github?

  • Yes, this is suited for github

I want some of my plugins to take values given in BetterAuthOptions and for them not to have to be redefined for each plugin that requires it (e.g. emails)
This also means that plugins higher up can edit the options for subsequent plugins

Describe the solution you'd like

Change of the plugin type to become

BetterAuthOptions => BetterAuthPlugin

so for most plugins it would go from

PluginOptions => BetterAuthPlugin

to

PluginOptions => BetterAuthOptions => BetterAuthPlugin

Describe alternatives you've considered

Giving each plugin options the same values.
And for the plugins I want to edit the options have the plugin called before initing BetterAuth and having it return a BetterAuthPlugin and Partial<BetterAuthOptions which is then used to override / add to my options

Additional context

I am currently making 4 plugins where this would be helpful (PRs to come)
I am happy to implement this myself and file a PR for this, I just thought that as this is a breaking change to make an issue first

Originally created by @R5dan on GitHub (Oct 9, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5187 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I want some of my plugins to take values given in `BetterAuthOptions` and for them not to have to be redefined for each plugin that requires it (e.g. emails) This also means that plugins higher up can edit the options for subsequent plugins ### Describe the solution you'd like Change of the plugin type to become ```ts BetterAuthOptions => BetterAuthPlugin ``` so for most plugins it would go from ```ts PluginOptions => BetterAuthPlugin ``` to ```ts PluginOptions => BetterAuthOptions => BetterAuthPlugin ``` ### Describe alternatives you've considered Giving each plugin options the same values. And for the plugins I want to edit the options have the plugin called before initing BetterAuth and having it return a `BetterAuthPlugin` and `Partial<BetterAuthOptions` which is then used to override / add to my options ### Additional context I am currently making 4 plugins where this would be helpful (PRs to come) I am happy to implement this myself and file a PR for this, I just thought that as this is a breaking change to make an issue first
GiteaMirror added the locked label 2026-04-13 06:09:23 -05:00
Author
Owner

@Bekacru commented on GitHub (Oct 9, 2025):

The problem is this will be a breaking change for existing plugins - for first party and downstream ones. You can pass init to customize options

<!-- gh-comment-id:3386400872 --> @Bekacru commented on GitHub (Oct 9, 2025): The problem is this will be a breaking change for existing plugins - for first party and downstream ones. You can pass `init` to customize options
Author
Owner

@R5dan commented on GitHub (Oct 9, 2025):

@Bekacru I know it is a breaking change, so wouldn't matter till next major release (even if you approve), the other option is to allow a BetterAuthPlugin object or a function (taking in BetterAuthOptions) and returning BetterAuthPlugin, that way it won't break existing plugins. I don't want to certain options to all plugins, such as appName or sending an email, when it is the same value as somewhere else.

<!-- gh-comment-id:3386750097 --> @R5dan commented on GitHub (Oct 9, 2025): @Bekacru I know it is a breaking change, so wouldn't matter till next major release (even if you approve), the other option is to allow a `BetterAuthPlugin` object or a function (taking in `BetterAuthOptions`) and returning `BetterAuthPlugin`, that way it won't break existing plugins. I don't want to certain options to all plugins, such as `appName` or sending an email, when it is the same value as somewhere else.
Author
Owner

@R5dan commented on GitHub (Oct 10, 2025):

@Bekacru Wait I realize what you meant now. That would work for getting the current options, does it let me change the options from my plugin (for future plugins)? If so then I can close the issue.

<!-- gh-comment-id:3388539696 --> @R5dan commented on GitHub (Oct 10, 2025): @Bekacru Wait I realize what you meant now. That would work for getting the current options, does it let me change the options from my plugin (for future plugins)? If so then I can close the issue.
Author
Owner

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

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

Issue Summary:

  • You proposed changing the plugin type to accept and modify BetterAuthOptions for sharing and updating common options across plugins, acknowledging this would be a breaking change.
  • Bekacru noted this change would break existing plugins and suggested using the init method to customize options instead.
  • You then suggested a hybrid approach allowing either a BetterAuthPlugin or a function returning one to avoid breaking changes.
  • You asked if the existing init method allows modifying options for future plugins, which might resolve the issue without requiring changes.

Next Steps:

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

Thanks for your understanding and contribution!

<!-- gh-comment-id:3729601406 --> @dosubot[bot] commented on GitHub (Jan 9, 2026): Hi, @R5dan. 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 proposed changing the plugin type to accept and modify `BetterAuthOptions` for sharing and updating common options across plugins, acknowledging this would be a breaking change. - Bekacru noted this change would break existing plugins and suggested using the `init` method to customize options instead. - You then suggested a hybrid approach allowing either a `BetterAuthPlugin` or a function returning one to avoid breaking changes. - You asked if the existing `init` method allows modifying options for future plugins, which might resolve the issue without requiring changes. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of better-auth by commenting here. - If I don’t hear back within 7 days, I will automatically close this issue. Thanks for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10182