Enforce Multi-Factor Authentication on Every Login Using Actions

Overview

This article describes how to enforce Multi-Factor Authentication (MFA) on every login event by utilizing Actions. It outlines the steps to configure the authentication policy and implement a specific code snippet to disable the browser remembrance option, ensuring users are prompted for MFA at every sign-in.

Applies To
  • Actions

  • Multi-Factor Authentication (MFA)

Solution
  1. Go to the Multi-factor Authentication settings.

  2. Set the Require Multi-factor Auth policy to Never.

  3. Go to Actions > Flows and select Login.

  4. Select the Post-Login trigger.

  5. Add the following code to the Action to enable MFA and disable the browser remembrance option:

exports.onExecutePostLogin = async (event, api) => {
    api.multifactor.enable("any", {allowRememberBrowser: false});
};

Recommended content

No recommended content found...