Sign-up and auth
Better Auth integration
A Better Auth server plugin checks each new user’s address with our API before Better Auth creates the user and, when the result is one you stop, the sign-up is refused with an error your client can show. Magic link and email OTP sign-ups are checked before any mail is sent.
Read the full setup guideGet an API key
- Setup guide
- One TypeScript plugin file, no database tables
EV_API_KEY your API keyAt a glance.
- Status
- Setup guide. Not listed on a marketplace yet: you set it up yourself in a few steps, below and in the full guide.
- For
- Apps built on Better Auth that want accounts made with an undeliverable or throwaway address kept out, whether people sign up with a password, a magic link, a one-time code or an OAuth provider.
- You need
- A Better Auth server, and an API key made for it, with a daily credit cap, kept in a server variable. The plugin goes into your server config only, never into the auth client.
- Costs
- 1 credit = 1 validated address, as with any API request. Free: unknown results, API errors, malformed addresses and test addresses on sandbox.email-validation.org.
- Full guide
- Read the full setup guide
Typical uses.
Refuse it with a clear error
An email and password sign-up with a stopped address gets an error with the code EMAIL_ADDRESS_NOT_ACCEPTED and your message, and no user row is written.
Send no mail to a bad address
Magic link and email OTP sign-ups are checked before the link or code goes out, so a stopped address never gets one and no user follows.
Leave returning users alone
Only a new user reaches the check. Someone signing in again, or linking a new provider to an account they have, is never checked and never charged.
Set it up. 4 steps.
The short version of the full setup guide, which stays the reference when a step does not match what you see.
Download the file
It is not on a registry yet: download email-validation-better-auth.ts from the guide and put it next to your Better Auth config.
Add the plugin
Add
emailValidation({ apiKey: process.env.EV_API_KEY })to thepluginsof your serverbetterAuth()config. There is no migration to run.Show the error
On the client, show
error.messagewhenerror.codeisEMAIL_ADDRESS_NOT_ACCEPTED. For OAuth, readerrorfrom your error callback page.Test it
Sign up with email and password as
disposable@sandbox.email-validation.org: it is refused, for free. Test addresses receive no mail, so do not use them for magic links or codes that would really be sent.
Good to know.
A user who changes their address later is not checked, and neither is anything that writes user rows to the database without going through Better Auth.
No key, a timeout, no credits or any other error lets the sign-up through. A check is never retried.
A magic link or code checked when it was sent is not checked again when it is used on the same server; on serverless hosts one sign-up can cost up to 2 credits.
Nothing is logged, and the address goes only to our US host, or with
region: 'eu'to our EU host.
Connect Better Auth
in a few minutes.
Test it on our sandbox addresses for free, then on your own contacts.
Updated · Maintained by: Email Validation LLC