Identities & Identifiers
A user is addressed by an identifier
One user can hold several: an email address, a phone number, a username. Each is a row of its own, each is separately verified, and each is scoped to one project and one environment. The kind is part of the lookup, not a hint.
The single most common mistake: forgetting kind
email on every call. The server selects the identity row by kind, so a phone sign-in that omits it looks a phone number up among email addresses, finds nothing, and returns the same opaque "credentials are not valid" you would get from a wrong password. Nothing in the response says "you sent the wrong kind". Pass it on signUp, requestCode and attempt alike, and pass the same value to all three.The three kinds
| Kind | Canonicalisation | Can receive a code |
|---|---|---|
email | Lowercased and trimmed | Yes — email code |
phone | E.164, always | Yes — SMS code |
username | Stored as given | No — password or a second factor only |
Phone numbers are canonicalised to E.164
One canonicaliser runs on every path — sign-up, prepare and attempt — so a number typed as (555) 123-4567 and one typed as +15551234567 are the same identity. A value that is not a valid phone number is refused rather than stored as-is.
await auth.requestCode({ identifier: '+15551234567', kind: 'phone' });
await auth.attempt({
identifier: '+15551234567',
kind: 'phone', // same value as above
strategy: 'sms_code',
code: '123456',
});Phone sign-in has an allowlist, and it starts at +1
+1 only, plus a monthly message cap defaulting to 500. A number outside the list is refused before a message is queued. If phone sign-in "does nothing" outside North America, this is why — add the codes in Project Settings → Auth → Phone sign-in.Verification
An identifier is verified when a code sent to it comes back. Until then it is unverified, and an unverified address does not inherit an organization's entitlements — otherwise claiming a stranger's address would claim their access.
Codes live ten minutes, are single-use, and are requested with a purpose: sign_in, verify_identifier or reset_password. The purposes are not interchangeable — a code minted for a password reset cannot sign anyone in. If it could, "forgot password" would be a complete authentication bypass for anyone who can request one.
Codes for returning users
requestCode is how an existing user gets a fresh code. Sign-up issues one as a side effect, but only for a new identifier — so without requestCode a returning person has no way to sign in passwordlessly at all. That is true for email exactly as much as SMS.
await auth.requestCode({ identifier: 'ada@example.com' });
// -> { sent: true, expiresInMinutes: 10 }sent: true means the request was accepted. It does not mean an account exists, and it does not mean delivery succeeded — both are deliberately indistinguishable, for the same enumeration reason as everywhere else.
Users and customers
When someone signs in, their user record is linked to a customer record — the thing that holds entitlements, purchases and analytics. The token carries the user as sub and the customer as cus.
Sandbox and production are separate identity spaces. The same email address in each is two different users, with two different customers, and a token minted in one cannot verify in the other.
Was this page helpful?
Or rate this page: