Passwordless — Email & SMS Codes
Two calls, one flow
requestCode sends a code; attempt with email_code or sms_code spends it. The channel was already decided by the identifier's kind when the code was requested — the two strategies verify identically.
The flow
await auth.requestCode({ identifier: 'ada@example.com' });
// -> { sent: true, expiresInMinutes: 10 }
const { session } = await auth.attempt({
identifier: 'ada@example.com',
strategy: 'email_code',
code: '123456',
});Without requestCode, returning users cannot sign in at all
signUp — the response is deliberately identical, so there is no error to notice either. requestCode is the only way to mint a code for an existing user, and that is as true for email as for SMS.What the response does and does not tell you
{ sent: true } means the request was accepted. It does not mean an account exists, and it does not mean the message was delivered. Both are indistinguishable on purpose: an endpoint that answered differently for a registered address would be a free account-enumeration tool.
Codes live ten minutes, are single-use, and are rate-limited to three requests per identifier per ten seconds. That limit also bounds what an attacker can spend of your SMS budget.
Purposes
| Purpose | For | Can complete a sign-in |
|---|---|---|
sign_in | Default. Signing an existing user in | Yes |
verify_identifier | Proving a newly added address or number | Yes |
reset_password | Password reset only | No — refused by attempt |
SMS: two settings that will surprise you
The dialling-code allowlist defaults to +1
The same card holds a monthly message cap, defaulting to 500 per project. It is a spend control: once reached, sends stop until the month rolls over. Raise it deliberately rather than discovering it during a launch.
Delivery
Auth mail is sent through your own provider, configured in project settings — BillDog will not fall back to sending as billdog.io, because a sign-in code arriving from an unfamiliar domain is both a support burden and a phishing lesson you do not want to teach your users. Configure a provider before enabling passwordless.
Next
- Identities — why
kindmatters so much. - Multi-factor
Was this page helpful?
Or rate this page: