Configuring Multi-Factor Authentication (MFA) as an Administrator in Keycloak

This topic explains how to configure Multi-Factor Authentication (MFA) in Keycloak as an administrator, including how to set MFA as a default requirement for new users and how to require specific users to set up MFA at their next login.

  1. Configure MFA settings for a realm
    1. Log in to the Keycloak administration console.
    2. Click Manage realms in the main menu.
    3. Select the realm where you want to configure MFA.
      If you are already in the correct realm, you can skip this step.
    4. Click Authentication in the left navigation menu.
    5. Open the Policies tab.
    6. Select the OTP Policy sub-tab.
    7. Adjust the One Time Password settings as needed for your organization.
      Keycloak currently supports FreeOTP, Google Authenticator, and Microsoft Authenticator. Not all OTP policy options are compatible with all of these providers. For more information, see Keycloak OTP Policy documentation.
  2. Set MFA as a default requirement for all new users
    1. Log in to the Keycloak administration console.
    2. Click Manage realms in the main menu.
    3. Select the realm where you want to require MFA for new users.
      If you are already in the correct realm, you can skip this step.
    4. Click Authentication in the left navigation menu.
    5. Open the Required Actions tab.
    6. Locate the action Configure OTP and enable Set as default action.
      If Configure OTP is not enabled, enable it first before setting it as the default action. For more information, see Keycloak Required Actions documentation.
  3. Require a specific user to set up MFA at next login
    1. Log in to the Keycloak administration console.
    2. Click Manage realms in the main menu.
    3. Select the realm where the user account is located.
      If you are already in the correct realm, you can skip this step.
    4. Click Users in the left navigation menu.
    5. Click the username of the user who should be required to set up MFA.
    6. In the Details tab, find the Required user actions field and select Configure OTP.
      For more information about authentication flows and required actions, see Keycloak Authentication Flows documentation.
    7. Click Save to apply the changes.