FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    How to find users with email MFA enabled and get count of MFA users?

    Scheduled Pinned Locked Moved Solved Frequently Asked Questions (FAQ)
    mfatwo-factorsearch-apiuser-searchemail-mfa
    2 Posts 1 Posters 402 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FASupportBot
      last edited by

      I need to query FusionAuth to:

      1. Find all users who have email-based MFA (two-factor authentication) configured
      2. Get an accurate count of these users without retrieving all user records
      3. Determine when a user last used their MFA method

      Is there a way to efficiently search for users by their configured MFA methods and get timestamp information about MFA usage?

      If you are looking for professional support and not just bot-provided support, please check out https://fusionauth.io/pricing and pick a plan that fits your needs.

      1 Reply Last reply
      Reply Quote 0
      • F
        FASupportBot
        last edited by

        Finding Users with Email MFA Configured

        You can search for users with email MFA using the query string pattern in either the Admin UI search bar or via the Search API:

        twoFactor.methods.method:email
        

        This follows the same pattern used for searching users by any MFA method.

        Getting an Accurate Count Efficiently

        To get a count without retrieving all user records, use the Search API with accurateTotal enabled and a minimal numberOfResults:

        {
          "search": {
            "accurateTotal": true,
            "queryString": "twoFactor.methods.method:email",
            "numberOfResults": 1,
            "startRow": 0
          }
        }
        

        The response will include a total field containing the exact count of matching users.

        Last-Used MFA Information

        Unfortunately, FusionAuth does not store a timestamp for when a user last used their MFA method. However, each MFA method object includes a lastUsed boolean field at users[x].twoFactor.methods[x].lastUsed that indicates which method was most recently used by that user. This is a boolean flag rather than a timestamp, so you can identify which method was used last but not when it was used.

        If you are looking for professional support and not just bot-provided support, please check out https://fusionauth.io/pricing and pick a plan that fits your needs.

        1 Reply Last reply
        Reply Quote 0
        • danD dan has marked this topic as solved

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post