MFA customized via PostLogin action but feature is not enabled

I am trying to customize a login flow into dashboard using post login action

exports.onExecutePostLogin = async (event, api) => {
  if (event.user.enrolledFactors?.length) {
    // already enrolled, challenge
    api.authentication.challengeWithAny(event.user.enrolledFactors.map(m => ({type: m.type})));
  }
  else {
    // not enrolled; choose a factor to enroll now
    api.authentication.enrollWithAny([{type: 'email'}, {type: 'otp'}]);
  }
  api.authentication.challengeWithAny([{type: 'email'}, {type: 'otp'}]);
};

But i am receiving the following error

{"message":"invalid_request (MFA customized via PostLogin action but feature is not enabled.)","errorCode":500}

My MFA are enabled in dashboard

Hi @rafael4 ,

Thanks for the info, I believe you are getting that error because of the use of the specific API object “api.authentication.enrollWithAny” . This API object is still in EA for limited number of tenants but we d have plans to move this to GA around mid-March.

Please keep an eye on the Auth0 Changelog for feature updates as you should see the announcement there once the feature becomes available for all tenants, thanks!