# MFA turn on off despite application - rules

**URL:** <https://community.auth0.com/t/mfa-turn-on-off-despite-application-rules/92876>\
**Category:** Get Help\
**Tags:** mfa\
**Created:** [October 21, 2022, 11:10am UTC](https://community.auth0.com/t/mfa-turn-on-off-despite-application-rules/92876 "2022-10-21T11:10:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mab/32/38495_2.png) [@mab](https://community.auth0.com/u/mab)\
**Post date:** [October 21, 2022, 11:10am UTC](https://community.auth0.com/t/mfa-turn-on-off-despite-application-rules/92876/1 "2022-10-21T11:10:29Z")

</div>

Hello,  
I know how to turnoff mfa in rules

> if (user.identities[0].connection === ‘test1’) {  
> context.multifactor = {  
> provider: ‘none’  
> };  
> }

I know how to enable only duo mode

> if (user.identities[0].connection === ‘test’) {  
> context.multifactor = {  
> provider: ‘duo’,  
> ikey: configuration.DUO\_IKEY,  
> skey: configuration.DUO\_SKEY,  
> host: configuration.DUO\_HOST,  
> allowRememberBrowser: true  
> };  
> }

I don’t know how to enable for the one application guardian and google auth. , for the second application guardian, google auth and email., for third only guardian and email.

Best Regards

---

<div class="post-metadata">

**Author:** ![mab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mab/32/38495_2.png) [@mab](https://community.auth0.com/u/mab)\
**Post date:** [October 25, 2022, 5:44am UTC](https://community.auth0.com/t/mfa-turn-on-off-despite-application-rules/92876/3 "2022-10-25T05:44:58Z")

</div>

Hi Team, if anything is unclear please write. I count on you 🙂 .

---

<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:** [October 25, 2022, 8:59pm UTC](https://community.auth0.com/t/mfa-turn-on-off-despite-application-rules/92876/4 "2022-10-25T20:59:26Z")

</div>

Hey there @mab!

> [@mab](#):
>
> I don’t know how to enable for the one application guardian and google auth. , for the second application guardian, google auth and email., for third only guardian and email.

I recommend moving over to [Actions](https://auth0.com/docs/customize/actions) and using the [API object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/api-object), but even then only the following options are available:

 ![Screen Shot 2022-10-25 at 1.31.26 PM](https://global.discourse-cdn.com/auth0/original/3X/f/f/ff8435b9f2c9b7261a0edfd933c535b06c3ba2ee.png)

Your post login Action might look something like:

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

  //enforce mfa for specific client_id(s)
  const mfaApp1 = "5sFZ3AuJ05fsdfQEauNhUfQjMfduVswiujzSqcfG";
  const mfaApp2 = "KnMtXwJypUghbc1IMKCDdLQKOXNqsdfsoLH2HXnQ";

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

```

Hope this helps at least give you an idea of what’s possible!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 8, 2022, 9:00pm UTC](https://community.auth0.com/t/mfa-turn-on-off-despite-application-rules/92876/5 "2022-11-08T21:00:02Z")

</div>

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