I am facing issues enabling MFA authentication with Duo when moving my code from a Rule to Actions. When disabling the rule and configuring the Login Flow with my action Duo is asking me for registration regardless my users are already registered but when enabling the rule Duo remains the user and send the push notification for the login.
Rule Code:
function multifactorAuthentication(user, context, callback) {
context.multifactor = {
provider: 'duo',
username: user.sAMAccountName // Here is the Duo user
};
callback(null, user, context);
}
Action Code:
exports.onExecutePostLogin = async (event, api) => {
api.multifactor.enable("duo", {
allowRememberBrowser: false,
providerOptions: {
username: event.user.sAMAccountName // Here is the Duo user
}
});
};
Additionally I tried setting username like this but did not work:
api.multifactor.enable("duo", {
allowRememberBrowser: false,
username: event.user.nickname // also: event.user.sAMAccountName
});
I will really appreciate any help with this issue. Thanks in advance!