✳ Lambatoken / Mobile DocsAUTH 0.7.0 · WALLET 0.2.0
Authentication / 04

Login and logout

Handle password authentication, MFA continuation, session creation and safe logout.

1. Submit credentials

Accept email or username as identifier and password. Never store the password. The SDK publishes either an authenticated session or an MFA-required state.

typescript
const result = await auth.login(identifier, password);
if (!result.authenticated) {
  // Navigate to MFA verification using result.challengeId.
} else {
  // Continue to authenticated bootstrap and PIN policy.
}

2. Complete MFA when required

Only complete a challenge issued by the current login. Wrong codes may be retried explicitly within challenge expiry; server attempt limits apply.

typescript
await auth.completeMfa(challengeId, code);
// Or abandon the login:
// await auth.cancelLogin();

3. Logout

Invalidate the session through the SDK; remove account-specific UI/query cache and wallet references. Never delete wallet keys as part of ordinary logout.

typescript
const receipt = await auth.logout();
if (!receipt.serverRevoked) {
  // Local logout succeeded; remote revocation is unconfirmed.
}