[GH-ISSUE #5543] Domain Verification for SSO #10280

Closed
opened 2026-04-13 06:18:27 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @tnkuehne on GitHub (Oct 24, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5543

Is this suited for github?

  • Yes, this is suited for github

When implementing self-serve SSO for customers, currently, the only safe way is to manually approve the domains, as there is a serious risk when doing the email matching via domain.

Describe the solution you'd like

A plugin that does domain verification via TXT DNS records by creating a token for a domain, saving it to the database, and then, in a verification step, checks if the user added the token in a TXT entry and saves the domain as verified in the database.

Describe alternatives you've considered

  • manual approval
  • implement outside of better-auth

Additional context

I have a working prototype of the plugin. If there is interest, I am happy to share, publish to npm, or contribute to better-auth.

Originally created by @tnkuehne on GitHub (Oct 24, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5543 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. When implementing self-serve SSO for customers, currently, the only safe way is to manually approve the domains, as there is a serious risk when doing the email matching via domain. ### Describe the solution you'd like A plugin that does domain verification via TXT DNS records by creating a token for a domain, saving it to the database, and then, in a verification step, checks if the user added the token in a TXT entry and saves the domain as verified in the database. ### Describe alternatives you've considered - manual approval - implement outside of better-auth ### Additional context I have a working prototype of the plugin. If there is interest, I am happy to share, publish to npm, or contribute to better-auth.
GiteaMirror added the locked label 2026-04-13 06:18:27 -05:00
Author
Owner

@TimFL commented on GitHub (Oct 27, 2025):

Maybe this PR could be enhanced, it seems to be doing something similar (although it's mainly geared at having custom domains for organizations): https://github.com/better-auth/better-auth/pull/3688/files#diff-2200df8a5fb2f75b86d45fcd3a4e80760e0f837fce02486e2006a67d7b615f16

<!-- gh-comment-id:3450486456 --> @TimFL commented on GitHub (Oct 27, 2025): Maybe this PR could be enhanced, it seems to be doing something similar (although it's mainly geared at having custom domains for organizations): https://github.com/better-auth/better-auth/pull/3688/files#diff-2200df8a5fb2f75b86d45fcd3a4e80760e0f837fce02486e2006a67d7b615f16
Author
Owner

@Bekacru commented on GitHub (Nov 3, 2025):

This is something we're interested on if anyone want to work on it!

<!-- gh-comment-id:3481464056 --> @Bekacru commented on GitHub (Nov 3, 2025): This is something we're interested on if anyone want to work on it!
Author
Owner

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

Thanks for your interest in advancing domain verification for SSO. To move forward, please consider these steps:

  1. Submit a pull request with your prototype, ensuring you include clear documentation on how the plugin:

    • Generates and stores a verification token for domains.
    • Checks the TXT DNS records to verify that the token has been added.
    • Updates the domain’s verification status in the database.
  2. Incorporate tests covering edge cases such as DNS propagation delays and misconfiguration to ensure robustness [1].

  3. Engage with maintainers in the issue or pull request discussion to refine integration details and configuration options (e.g., fallback strategies if the TXT verification fails) [1].

Following these steps will help integrate the plugin smoothly into the core system. Let us know if you need any further support during this process.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3481465565 --> @better-auth-agent[bot] commented on GitHub (Nov 3, 2025): Thanks for your interest in advancing domain verification for SSO. To move forward, please consider these steps: 1. Submit a pull request with your prototype, ensuring you include clear documentation on how the plugin: - Generates and stores a verification token for domains. - Checks the TXT DNS records to verify that the token has been added. - Updates the domain’s verification status in the database. 2. Incorporate tests covering edge cases such as DNS propagation delays and misconfiguration to ensure robustness [[1]](https://github.com/better-auth/better-auth/issues/5543). 3. Engage with maintainers in the issue or pull request discussion to refine integration details and configuration options (e.g., fallback strategies if the TXT verification fails) [[1]](https://github.com/better-auth/better-auth/issues/5543). Following these steps will help integrate the plugin smoothly into the core system. Let us know if you need any further support during this process. <!-- 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)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10280