Skip MFA from Actions with api.multifactor.enable('none');

Overview

This article explains how to use an Action to skip Multi-factor Authentication (MFA) in certain scenarios when Adaptive MFA is configured or when the MFA policy is set to Always.

Applies To

  • Actions
  • Multi-factor Authentication (MFA)
  • Skip MFA

Solution

To skip MFA from an Action when the MFA Policy is set to Adaptive or Always:

exports.onExecutePostLogin = async (event, api) => {
  if (/* custom logic */) {
    api.multifactor.enable('none');
  }
};