Auth platforms
Keep Supabase or Better Auth; let Verifyme deliver their codes.
Your auth platform keeps generating and checking its codes. Verifyme delivers
them through your providers, routing, firewall and send limits, and records
every send in Verifications. Caller-supplied codes are billed as sends. Once
your platform accepts a code, confirm it so it shows as verified — or send it
send_only and it closes at once instead of expiring as pending.
Supabase
Supabase calls a hook with each code it generates.
- In Supabase, open Authentication → Hooks, add a Send SMS (or Send Email) hook of type HTTPS, and generate its secret.
- In Verifyme, open Console → Integrations → Connect, choose the hook and paste the secret.
- Copy the hook URL it shows back into Supabase.
Calls are authenticated by the Standard Webhooks signature Supabase sends; anything unsigned, stale or re-signed is refused. Phone codes go in the language of the number's country.
Better Auth
Two ways, both from @cubis/verifyme-better-auth (Better Auth 1.7+). Each
send carries the end user's IP and User-Agent — resolved by your Better Auth
advanced.ipAddress settings — so your firewall
judges the user, not your server.
npm i @cubis/verifyme @cubis/verifyme-better-authVerifyme sends and checks
The verifyme plugin owns the code end to end — Verifyme generates, delivers
and checks it, counts attempts and burns it after five — and signs the user in,
or up.
import { betterAuth } from "better-auth"
import { Verifyme } from "@cubis/verifyme"
import { verifyme } from "@cubis/verifyme-better-auth"
export const auth = betterAuth({
plugins: [
verifyme({
client: Verifyme.fromEnv(),
// Better Auth needs an email on every user; omit to allow only existing users by phone.
phoneSignUp: { tempEmail: (phone) => `${phone.slice(1)}@phone.example.com` },
}),
],
})import { createAuthClient } from "better-auth/react"
import { verifymeClient } from "@cubis/verifyme-better-auth/client"
export const authClient = createAuthClient({ plugins: [verifymeClient()] })
await authClient.verifyme.sendOtp({ target: "+85512345678" }) // or an email
await authClient.verifyme.verifyOtp({ target: "+85512345678", code: "123456" })The Verifyme token stays in Better Auth's verification store; the browser never
sees it. Options: phoneProvider, emailProvider, locale, length
(default 6), timeout (default 300 s), disableSignUp. Sends are limited to 3
a minute per client; your Verifyme firewall and send limits apply behind that.
Better Auth checks, Verifyme delivers
Keep Better Auth's phoneNumber and emailOTP plugins and register the sender
as a plugin too: each code is confirmed in Verifyme once Better Auth accepts it.
import { phoneNumber, emailOTP } from "better-auth/plugins"
import { verifymeSender } from "@cubis/verifyme-better-auth"
const sender = verifymeSender(Verifyme.fromEnv())
export const auth = betterAuth({
plugins: [
phoneNumber({ sendOTP: sender.sendOTP, sendPasswordResetOTP: sender.sendOTP }),
emailOTP({ sendVerificationOTP: sender.sendVerificationOTP }),
sender, // confirms accepted codes in Verifyme
],
})Pass confirm: false (or leave sender out of plugins) to send every code
send_only. Also takes phoneProvider (default "sms", e.g. "whatsapp"),
emailProvider (default "email"), locale and timeout (default 300 s — keep
it at least Better Auth's expiresIn).
Any other platform
Send the platform's code with code, then confirm it with check() once the
platform accepts it — or pass send_only: true if you never will:
const { token } = await verifyme.send({ target: "+14155550100", code: "482915" })
// … the platform accepted the code:
await verifyme.check({ token, code: "482915" })curl -X POST https://verifyme.cubis.tech/api/v1/verify \
-H "x-api-key: $VERIFYME_API_KEY" -H "content-type: application/json" \
-d '{"target":"+14155550100","code":"482915"}'