Skip to main content
function initiateMfaEnrollment(options: InitiateMfaOptions): Promise<InitiateMfaEnrollmentResult>;
Initiates MFA enrollment for an end user for the TOTP method. This endpoint generates a TOTP secret and returns an otpauth:// URL that can be scanned with an authenticator app like Google Authenticator. The secret must be verified within 5 minutes by calling submitMfaEnrollment.

Parameters

ParameterTypeDescription
optionsInitiateMfaOptionsThe options for initiating MFA enrollment.

Returns

Promise<InitiateMfaEnrollmentResult> The result containing authUrl and secret.

Example

const result = await initiateMfaEnrollment({ mfaMethod: "totp" });
// Display result.authUrl as QR code or provide result.secret for manual entry
console.log("Scan this QR code:", result.authUrl);
console.log("Or enter this secret manually:", result.secret);