Api.multifactor.disable

Hi there,
For sake of user experience i want to disable the mfa for a specific admin user on my web app if the users comes from the city = california.For any user MFA should be enabled first time later on subsequent visits for this admin user if he was trying to come from california mfa should be disable, i was trying with below(api.multifactor.disable()) wich doesn’t work.pls adcive.

exports.onExecutePostLogin = async (event, api) => {
const city = event.request.geoip.cityName;
if (city == ‘California’) {
api.multifactor.enable(“none”);
}

Hi @ysharat,

There isn’t a api.multifactor.disable() method.

Instead, you must use the api.multifactor.enable() method.

For example:

exports.onExecutePostLogin = async (event, api) => {
  const city = event.request.geoip.cityName;
  if (city !== ‘California’) {
    api.multifactor.enable('any', { allowRememberBrowser: false });
  }
}

Please keep me posted on how this goes for you.

Thanks,
Rueben

Nope, it doens’t work. However Ignore it for a while, will get back to you on this with the detailed requirment.

Hi @ysharat,

Thanks for the reply.

Could you share with me what you experienced when it did not work? Does MFA stay enabled for the user?

If so, you might need to turn MFA off and use the Action script to enable MFA. This tends to provide more control over the MFA experience for your users.

And sure, I can wait for your update on the detailed requirements.

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.