Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Initiate Two-Factor Authentication with Apex

Initiate your two-factor authentication process with two new Apex methods in the System.UserManagement class. To verify a user’s identity with email, phone (SMS), or Salesforce Authenticator verification, pair the methods—one to initiate a verification service and one to complete the verification service. For password or time-based one-time password (TOTP) verification, you can use the second method alone to provide a complete verification service.

Where: This change applies to Lightning Experience and Salesforce Classic in Essentials, Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, and Developer editions.

How: Depending on the type of verification, use one or both of these Apex methods.
  • System.UserManagement.initVerificationMethod
  • System.UserManagement.verifyVerificationMethod