MFA & Tenancy
Complete an MFA-gated login, read MFA status, and switch the active tenant.
Multi-factor authentication
When an account has MFA enabled, a normal login does not sign the user in. Instead, login returns an AuthResponse with isRequiresMfa == true and stores no tokens. You then send a one-time code and verify it to complete the login.
The flow is three calls:
login(...)→ returnsAuthResponsewithisRequiresMfa == true.sendMfaChallenge(method: 'email')→ delivers a one-time code.verifyMfa(otp: enteredCode)→ completes the login and persists tokens.
sendMfaChallenge
Requests a one-time code during an MFA-gated login. method is 'email' or 'phone':
verifyMfa
Completes the login with the one-time otp. Pass trustDevice: true to remember this device and skip MFA on future logins (subject to backend policy):
getMfaStatus
Read the current user's MFA configuration — for example to drive a security-settings screen:
Multi-tenancy
If a user belongs to several tenants, switchTenant re-issues tokens scoped to the target tenant and persists them, so subsequent requests run in that tenant's context:
Several other methods also accept a
tenantIdto scope a single call — includinglogin,signup,passwordlessSend,passwordlessLogin,verifyForgotPasswordOtp,verifyEmail, andverifyPhone. UseswitchTenantwhen you want to change the tenant for the whole session.