[GH-ISSUE #7001] onUserVerified Hook #28019

Closed
opened 2026-04-17 19:21:38 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @thyngster on GitHub (Dec 26, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/7001

Is this suited for github?

  • Yes, this is suited for github

Not a "problem" at all.

I usually send a welcome email after a user verifies their account, which works well using emailVerification.onVerifyEmail. The issue arises with OAuth logins: those users are automatically verified, so onVerifyEmail is never triggered.

Describe the solution you'd like

I’m currently using a database hook to detect account creation on OAuth, so i had to add the mail sending logic in 2 places, but I’m wondering whether it would make more sense for onVerifyEmail to be globa callback rather than tied specifically to email/password authentication.

Describe alternatives you've considered

I’m currently using a database hook to detect account creation on OAuth, so i had to add the mail sending logic in 2 places, but I’m wondering whether it would make more sense for onVerifyEmail to be globa callback rather than tied specifically to email/password authentication.

Additional context

No response

Originally created by @thyngster on GitHub (Dec 26, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/7001 ### Is this suited for github? - [ ] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Not a "problem" at all. I usually send a welcome email after a user verifies their account, which works well using emailVerification.onVerifyEmail. The issue arises with OAuth logins: those users are automatically verified, so onVerifyEmail is never triggered. ### Describe the solution you'd like I’m currently using a database hook to detect account creation on OAuth, so i had to add the mail sending logic in 2 places, but I’m wondering whether it would make more sense for onVerifyEmail to be globa callback rather than tied specifically to email/password authentication. ### Describe alternatives you've considered I’m currently using a database hook to detect account creation on OAuth, so i had to add the mail sending logic in 2 places, but I’m wondering whether it would make more sense for onVerifyEmail to be globa callback rather than tied specifically to email/password authentication. ### Additional context _No response_
GiteaMirror added the lockedenhancement labels 2026-04-17 19:21:38 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 26, 2025):

It sounds like you're looking for a solution to the issue of sending a welcome email after user verification when using OAuth logins in the Better Auth framework. It seems you're currently managing this by using a database hook to detect account creation through OAuth, which is a valid approach, but it does duplicate code for sending emails.

Your suggestion to make the onVerifyEmail a global callback that is not tied specifically to email/password authentication could certainly simplify your code. This way, you would only have one implementation for sending welcome emails regardless of the authentication method used.

This topic is worth discussing further, and it might be beneficial to bring this up in the Better Auth community or tag the Better Auth team (Beka and Max) for more tailored feedback or suggestions on your implementation. You can use the tags @bekacru or @ping__ when you reach out to them.

What are your thoughts on this approach, or do you have other questions regarding the integration of hooks in Better Auth?

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

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3691846747 --> @better-auth-agent[bot] commented on GitHub (Dec 26, 2025): It sounds like you're looking for a solution to the issue of sending a welcome email after user verification when using OAuth logins in the Better Auth framework. It seems you're currently managing this by using a database hook to detect account creation through OAuth, which is a valid approach, but it does duplicate code for sending emails. Your suggestion to make the `onVerifyEmail` a global callback that is not tied specifically to email/password authentication could certainly simplify your code. This way, you would only have one implementation for sending welcome emails regardless of the authentication method used. This topic is worth discussing further, and it might be beneficial to bring this up in the Better Auth community or tag the Better Auth team (Beka and Max) for more tailored feedback or suggestions on your implementation. You can use the tags @bekacru or @ping__ when you reach out to them. What are your thoughts on this approach, or do you have other questions regarding the integration of hooks in Better Auth? _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/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@thyngster commented on GitHub (Dec 26, 2025):

Explained all this wrong. closing and opening a proper one

<!-- gh-comment-id:3691863202 --> @thyngster commented on GitHub (Dec 26, 2025): Explained all this wrong. closing and opening a proper one
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#28019