function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Guillaume ZeemanGuillaume Zeeman 

Detect if a user has multi factor authentication configured with code

We want to provide community users with the ability to configure multi factor authentication. If a user who has a device connected but recently got a new phone, we would like to offer this user the ability to disconnect the old device. But in order to do that, we first need to know if the user has a device connected.

Does anyone know if you can detect/query if a specific user has a multi factor authentication method configured? Either with Apex, an API call or some other method we have not thought of?

Any help will be much appreciated.
Remco SellmeijerRemco Sellmeijer
I think you are looking for "TwoFactorMethodsInfo"

https://developer.salesforce.com/docs/atlas.en-us.220.0.api.meta/api/sforce_api_objects_twofactormethodsinfo.htm