# Enable only email MFA

**URL:** <https://community.auth0.com/t/enable-only-email-mfa/134215>\
**Category:** Get Help\
**Tags:** email-factor, mfa\
**Created:** [May 15, 2024, 8:20pm UTC](https://community.auth0.com/t/enable-only-email-mfa/134215 "2024-05-15T20:20:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ywaka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ywaka/32/50292_2.png) [@ywaka](https://community.auth0.com/u/ywaka)\
**Post date:** [May 15, 2024, 8:20pm UTC](https://community.auth0.com/t/enable-only-email-mfa/134215/1 "2024-05-15T20:20:39Z")

</div>

Hi! We started subscribed to the Enterprise plan to use email MFA.  
We only want to use email as an MFA factor, but it seems we can’t enable email only.  
Currently, we have both SMS and email options enabled.  
Is there any way to enable only the email factor?  
I understand email isn’t considered a true MFA according to posts from a few years ago, but I’m hoping there have been updates since then.

---

<div class="post-metadata">

**Author:** ![ywaka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ywaka/32/50292_2.png) [@ywaka](https://community.auth0.com/u/ywaka)\
**Post date:** [May 15, 2024, 9:45pm UTC](https://community.auth0.com/t/enable-only-email-mfa/134215/2 "2024-05-15T21:45:10Z")

</div>

Actually, I found a way to enable only email MFA when the user logs in.

1. Enabled ‘Customize MFA Factors using Actions’ in the Auth0 dashboard.
2. Added the following code to the post-login Action:

```auto
exports.onExecutePostLogin = async (event, api) => {
    if (event.stats.logins_count > 1) {
        api.authentication.challengeWith({ type: 'email' });
    }
};

```

I used `event.stats.logins_count > 1` because when a user registers, it increases `logins_count` to 1. If I remove that condition and execute `api.authentication.challengeWith({ type: 'email' })` during registration, I get an error.

So, my question: Is there any way to display email MFA only when the user first registers?  
By default, it displays other factors such as SMS.  
I know Auth0 sends a verification email to the user, but I want to display the Email MFA option the same as when logging in.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![ywaka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ywaka/32/50292_2.png) [@ywaka](https://community.auth0.com/u/ywaka)\
**Post date:** [September 17, 2024, 9:38pm UTC](https://community.auth0.com/t/enable-only-email-mfa/134215/3 "2024-09-17T21:38:00Z")

</div>

I haven’t visited the Auth0 community for a while, but for your information, I have resolved the issue.  
Select the ‘Never’ for the Require Multi-factor Auth in the setting and added the code something like this

```auto
exports.onExecutePostLogin = async (event, api) => {
    if (event.stats.logins_count > 1) {
         if (event.user.email_verified) {
                 api.multifactor.enable('any')
                 api.authentication.challengeWith({ type: 'email' });
         }
    }
};

```

to enable only the email option.  
I’m leaving this note for anyone who might have a similar issue.

---

<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:** [September 17, 2024, 10:15pm UTC](https://community.auth0.com/t/enable-only-email-mfa/134215/4 "2024-09-17T22:15:59Z")

</div>

That’s great @ywaka thanks for sharing your solution! ✅

---

<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:** [October 1, 2024, 10:16pm UTC](https://community.auth0.com/t/enable-only-email-mfa/134215/5 "2024-10-01T22:16:15Z")

</div>

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