?
AuthErrorCode
TypeThe code on a thrown auth error; branch on it to message a failure precisely.
The code an auth method throws on failure, so a login screen can answer the exact cause instead of parsing a message. Catch the error and branch on err.code: tell a wrong code from an expired one, and a restricted address (email_not_allowed) from a burner one (disposable_email_blocked). The interface-level codes auth_required and role_required come from an agent or voice interface's own auth gate.
AuthErrorCode.ts
type AuthErrorCode = | 'invalid_code' | 'verification_expired' | 'max_attempts_exceeded' | 'rate_limited' | 'email_not_allowed' | 'disposable_email_blocked' | 'invalid_state' | 'popup_blocked' | 'signin_timeout'
Fields
'invalid_code'
Wrong verification code.
'verification_expired'
The code has expired; request a new one.
'max_attempts_exceeded'
Too many wrong attempts; start the flow over.
'rate_limited'
Too many requests; try again shortly.
'email_not_allowed'
The signup allowlist is on and this address is not on it.
'disposable_email_blocked'
A burner email domain was rejected at send.
'invalid_state'
Sign in with Remy: the returned state did not match a live request.
'popup_blocked'
Sign in with Remy (embedded): the popup was blocked.
'signin_timeout'
Sign in with Remy (embedded): the popup did not finish in time.
Branch on the code
try {
await auth.verifyEmailCode(id, code);
} catch (err) {
if (err.code === 'invalid_code') setError('Wrong code. Try again.');
else if (err.code === 'verification_expired') setError('Code expired. Request a new one.');
}