# Enable MFA per org

**URL:** <https://community.auth0.com/t/enable-mfa-per-org/85273>\
**Category:** Get Help\
**Tags:** organizations, actions, mfa\
**Created:** [June 17, 2022, 2:48am UTC](https://community.auth0.com/t/enable-mfa-per-org/85273 "2022-06-17T02:48:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnilGanivada](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anilganivada/32/13106_2.png) [@AnilGanivada](https://community.auth0.com/u/AnilGanivada)\
**Post date:** [June 17, 2022, 2:48am UTC](https://community.auth0.com/t/enable-mfa-per-org/85273/1 "2022-06-17T02:48:59Z")

</div>

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

```auto
  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);

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 29, 2022, 12:23am UTC](https://community.auth0.com/t/enable-mfa-per-org/85273/3 "2022-06-29T00:23:18Z")

</div>

Hello @AnilGanivada welcome back to the community!

I apologize for the delayed response, but have you had any luck in getting this to work for your use case? I _think_ this should be possible, although I would recommend looking into using an [Action](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow) as opposed to a rule.

Let us know where you landed with this and perhaps myself or someone else from the community can help 😄

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 14, 2022, 12:23am UTC](https://community.auth0.com/t/enable-mfa-per-org/85273/4 "2022-07-14T00:23:43Z")

</div>

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