Hi,
We use Auth0 organizations feature extensively, our login flow is a bit customized when a user logs in they don’t mention the organization instead we fetch organizations from the backend on successful login and use silent authentication to automatically switch user to an organization they are part of. if there are multiple organizations we prompt user and let them select an organization. Recently we wanted to enable MFA for a specific org, we used actions to customize login flow such that we look for a specific metadata attribute in an organization and enforce mfa.
The challenge we are running into is since we don’t prompt the organization when a user logs in, MFA fails when we use silent authentication to switch user to an organization where MFA is enforced. Is there anyway to enable prompt for MFA with silent auth? Here is the rule we are using to enable MFA for specific org
if(context.organization && context.organization.metadata.mfa_enabled && context.organization.metadata.mfa_enabled === 'true') {
const completedMfa = !!context.authentication.methods.find(
(method) => method.name === 'mfa'
);
if (completedMfa) {
return callback(null, user, context);
}
context.multifactor = {
provider: 'any',
allowRememberBrowser: false
};
callback(null, user, context);