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:
However it looks like the username attribute is ignored and Auth0 still sends ids to to Duo. I changed the skey to something wrong and it broke the integration. Which suggest that this is the right way of customizing the duo config, but there is an issue with the way username is processed.