# Dynamically disable MFA when using Passkeys

**URL:** <https://community.auth0.com/t/dynamically-disable-mfa-when-using-passkeys/182697>\
**Category:** Get Help\
**Tags:** phone-factor, mfa\
**Created:** [February 24, 2025, 8:06am UTC](https://community.auth0.com/t/dynamically-disable-mfa-when-using-passkeys/182697 "2025-02-24T08:06:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex.fechner](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alex.fechner/32/70869_2.png) [@alex.fechner](https://community.auth0.com/u/alex.fechner)\
**Post date:** [February 24, 2025, 8:06am UTC](https://community.auth0.com/t/dynamically-disable-mfa-when-using-passkeys/182697/1 "2025-02-24T08:06:29Z")

</div>

Ready to post? 🔍 First, try searching for your answer.  
Hi all,

we’re using passkeys and SMS based MFA.

For some users (test users etc.) we need to be able to dynamically disable MFA.

We use and action and evaluate a property called `mfa_enabled` in the user’s `app_metadata`:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const mfaEnabled = event.user.app_metadata?.mfa_enabled;

  if (mfaEnabled === false) {
    api.multifactor.enable("none");
    return;
  }
}

```

This approach works fine for us in other projects.

Now, combining it with passkeys we’re running into an issue: The MFA is skipped as expected but when creating a passkey, the MFA enrollment process is triggered on the first time.

If the user is not creating a passkey and going through the login again for the second time the MFA enrollment process is not started.

We’d expect that `api.multifactor.enable("none");` would completely disable MFA (challenge plus enrollment).

Can you help? Thanks!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 24, 2025, 9:40pm UTC](https://community.auth0.com/t/dynamically-disable-mfa-when-using-passkeys/182697/4 "2025-02-24T21:40:23Z")

</div>

Hi @alex.fechner,

Welcome to the Auth0 Community!

Firstly, have you made sure you have disabled MFA in your tenant settings under [_Dashboard \> Security \> Multi-factor Auth_](https://manage.auth0.com/#/security/mfa)?

If not, this setting will ensure that MFA is disabled, and only your post-login action script can be used to trigger MFA, which will override that setting.

As for your post-login script, I recommend referring to [this example](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger#reduce-friction-with-passkeys) which shows you to skip MFA for a user than has authenticated with a passkey.

Thanks,  
Rueben

---

<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:** [March 10, 2025, 9:40pm UTC](https://community.auth0.com/t/dynamically-disable-mfa-when-using-passkeys/182697/5 "2025-03-10T21:40:46Z")

</div>

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