Add callbackUrl options to Email OTP #2209

Closed
opened 2026-03-13 09:34:46 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @0scrm on GitHub (Oct 26, 2025).

Is this suited for github?

  • Yes, this is suited for github

Similar to what is possible with social sign-in or magic link, I would like an option to customize the callbackUrl upon successful login using email OTP.

Describe the solution you'd like

signIn.emailOtp would take three new parameters:

callbackURL: string;
newUserCallbackURL: string;
errorCallbackURL: string;

If provided, the user would be redirected to callbackURL by default, and to newUserCallbackURL or errorCallbackURL when applicable. If not provided, the current behavior should remain unchanged.

Describe alternatives you've considered

I didn't find a real alternative, except maybe writing a custom middleware?

Additional context

I would be happy to implement this improvement, I am currently following what has been done for the magic link plugin. Let me know if this makes sense and if I should spend the time on it :)

Originally created by @0scrm on GitHub (Oct 26, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Similar to what is possible with **social sign-in** or **magic link**, I would like an option to customize the `callbackUrl` upon successful login using **email OTP**. ### Describe the solution you'd like `signIn.emailOtp` would take three new parameters: ```ts callbackURL: string; newUserCallbackURL: string; errorCallbackURL: string; ``` If provided, the user would be redirected to `callbackURL` by default, and to `newUserCallbackURL` or `errorCallbackURL` when applicable. If not provided, the current behavior should remain unchanged. ### Describe alternatives you've considered I didn't find a real alternative, except maybe writing a custom middleware? ### Additional context I would be happy to implement this improvement, I am currently following what has been done for the magic link plugin. Let me know if this makes sense and if I should spend the time on it :)
GiteaMirror added the enhancement label 2026-03-13 09:34:46 -05:00
Author
Owner

@OmprakashD20 commented on GitHub (Nov 28, 2025):

@Bekacru Can i work on this?

@OmprakashD20 commented on GitHub (Nov 28, 2025): @Bekacru Can i work on this?
Author
Owner

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

Hi, @0scrm. 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 adding customizable callback URL parameters (callbackURL, newUserCallbackURL, errorCallbackURL) to the email OTP sign-in method.
  • This feature aims to provide better redirection control, similar to existing social sign-in and magic link functionalities.
  • Another user expressed interest in implementing this enhancement, and it received positive feedback.
  • The issue remains unresolved with no implemented changes yet.

Next Steps:

  • Please let me know if this feature is still relevant to the latest version of better-auth by commenting on this issue.
  • If I do not hear back within 7 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Feb 27, 2026): Hi, @0scrm. 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 adding customizable callback URL parameters (callbackURL, newUserCallbackURL, errorCallbackURL) to the email OTP sign-in method. - This feature aims to provide better redirection control, similar to existing social sign-in and magic link functionalities. - Another user expressed interest in implementing this enhancement, and it received positive feedback. - The issue remains unresolved with no implemented changes yet. **Next Steps:** - Please let me know if this feature is still relevant to the latest version of better-auth by commenting on this issue. - If I do not hear back within 7 days, I will automatically close this issue. Thank you 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#2209