# Enable 2FA only on selected applications

**URL:** <https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800>\
**Category:** Get Help\
**Tags:** 2fa\
**Created:** [June 23, 2022, 1:30pm UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800 "2022-06-23T13:30:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![leandro](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/leandro/32/38672_2.png) [@leandro](https://community.auth0.com/u/leandro)\
**Post date:** [June 23, 2022, 1:30pm UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800/1 "2022-06-23T13:30:24Z")

</div>

Hi guys, I managed enabling 2fa on general settings on:  
security → multi-factor-auth → phone message.

Now , all my existing applications implements 2fa.  
How can enable 2fa only on desired applications ?  
Thanks.

---

<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 24, 2022, 7:56pm UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800/3 "2022-06-24T19:56:18Z")

</div>

Hello @leandro !

> [@leandro](#):
>
> Now , all my existing applications implements 2fa.  
> How can enable 2fa only on desired applications ?

You can accomplish this by using a [Post Login Action](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow) - Something like this:

```auto
exports.onExecutePostLogin = async (event, api) => {

  //enforce mfa for specific client_id(s)
  const mfaApp1 = "client_id_1";
  const mfaApp2 = "client_id_2";

   if (event.client.client_id === mfaApp1 || mfaApp2) {
    console.log(`enforcing mfa for: ${event.client.client_id}`)
    api.multifactor.enable(`any`);
   } else {
     console.log(`mfa not enforced for: ${event.client.client_id}`)
   }
};

```

**Important note** - You’ll need to set to require MFA to **Never** in your tenant → Security → Multi-factor Auth in order for this to work.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![leandro](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/leandro/32/38672_2.png) [@leandro](https://community.auth0.com/u/leandro)\
**Post date:** [July 1, 2022, 1:18pm UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800/4 "2022-07-01T13:18:11Z")

</div>

Is it possible to check some option on administration panel ?

---

<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 1, 2022, 6:29pm UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800/5 "2022-07-01T18:29:54Z")

</div>

There unfortunately is not an easy way to accomplish this on an app by app basis from the dashboard - This could be a good candidate for a [feedback request](https://community.auth0.com/c/feedback/95). We monitor these closely for community engagement.

---

<div class="post-metadata">

**Author:** ![leandro](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/leandro/32/38672_2.png) [@leandro](https://community.auth0.com/u/leandro)\
**Post date:** [July 4, 2022, 11:42am UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800/6 "2022-07-04T11:42:41Z")

</div>

Ok , and what about management api ?  
would be worthly to investigate ?

---

<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 6, 2022, 11:48pm UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800/7 "2022-07-06T23:48:41Z")

</div>

The Management API essentially mirrors what’s available in the Dashboard and thus doesn’t provide a way to enable/disable MFA on an app by app basis - You can see what is supported by the Management API here:

> **[Auth0 Management API v2](https://auth0.com/docs/api/management/v2)**

---

<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 21, 2022, 11:48pm UTC](https://community.auth0.com/t/enable-2fa-only-on-selected-applications/85800/8 "2022-07-21T23:48:52Z")

</div>

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