# \[MFA\] Need to challenge user with existing factor before enrolling into new factor (even if already been challenged)

**URL:** <https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011>\
**Category:** Get Help\
**Tags:** phone-factor, mfa\
**Created:** [July 10, 2025, 8:34am UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011 "2025-07-10T08:34:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel.bozinovski](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/daniel.bozinovski/32/71029_2.png) [@daniel.bozinovski](https://community.auth0.com/u/daniel.bozinovski)\
**Post date:** [July 10, 2025, 8:34am UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011/1 "2025-07-10T08:34:49Z")

</div>

Hi everyone,

I’m looking for some advice regarding custom post-login MFA actions for handling user enrollment and challenges.

Here’s the issue I’ve encountered:

When I’m already enrolled in an existing factor (e.g., OTP) and attempt to enroll in a second factor (e.g: phone) using enrollWith, I receive the following error:

 ![Screenshot 2025-07-10 at 6.32.47 pm](https://global.discourse-cdn.com/auth0/original/3X/f/3/f38a443e38e5e1e1efbb4d4606b26cd97be82026.png)

Additionally, the logs show this message:  
`An MFA enrollment was requested but the user is already enrolled in MFA. Challenge with at least one existing factor before enrolling a new one.`

This happens even when authentication.methods already includes “mfa”.

If I use challengeWith before attempting the enrollment, it works as expected. However, this approach forces users to go through multiple challenges, which can feel redundant and unnecessary.

Is there a way to avoid re-challenging the user if their existing session has already been challenged?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [July 14, 2025, 8:07pm UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011/3 "2025-07-14T20:07:39Z")

</div>

Hi @daniel.bozinovski

Welcome to the Auth0 Community!

I am sorry about the delayed response to your inquiry!

In order to enroll a user to multiple MFAs, your action should look like this:

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

if (event.user.user_metadata.enrolledWithOtp === false && event.user.user_metadata.enrolledWithPhone === false) {
    // already enrolled, challenge
   api.authentication.challengeWithAny([{ type: 'phone'}, { type: 'otp' }]);

}
else{
      api.authentication.enrollWith({type: 'otp'});
  if(forceEnroll){
        api.authentication.enrollWith({type: 'phone'});

  }
}
}

```

For further information on the matter, I would recommend to review our [documentation](https://auth0.com/docs/secure/multi-factor-authentication/customize-mfa/customize-mfa-enrollments-universal-login).

This way, the user will be asked to enroll to both factors when signing up or logging in or be forced to enroll in both factors.

If you have any other questions, let me know!

Kind regards

---

<div class="post-metadata">

**Author:** ![daniel.bozinovski](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/daniel.bozinovski/32/71029_2.png) [@daniel.bozinovski](https://community.auth0.com/u/daniel.bozinovski)\
**Post date:** [July 14, 2025, 10:49pm UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011/4 "2025-07-14T22:49:54Z")

</div>

Hey @nik.baleca , thanks for the reply!

However, I don’t think my specific issue was fully addressed. My main concern is avoiding redundant MFA challenges when a user is already enrolled in one factor (e.g., OTP) and wants to enroll in a second factor (e.g., phone). I understand that using challengeWith before enrollWith works, but it forces the user to go through an additional challenge, which feels unnecessary if their session has already been authenticated or challenged.

Is there a way to bypass re-challenging the user in the same session after they’ve already been verified? I’m looking for a solution to streamline the enrollment process for additional factors without compromising security.

Thanks again for your help!

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [July 14, 2025, 11:31pm UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011/5 "2025-07-14T23:31:16Z")

</div>

Hey again!

Sorry that I have missed that part. Just to understand what you are talking about. If an user who is already enrolled for OTP wants to enroll for another factor, do you wish to skip the part where the user is challenged for the 2nd factor during enrollment?  
Ore do you wish to allow users to enroll to a 2nd factor while they are logged in without having them log out and back in so that the process is triggered by the PostLogin Action?

If that is the case, this can be quite hard to accomplish, and would require you to build your own UI to handle the behaviour. You can read more about that in our documentation here:

- [Get MFA access token](https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authenticator-factors-mfa-api)
- [Enroll authenticator - SMS, Phone, TOTP](https://auth0.com/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-otp-authenticators).

Otherwise, if you are talking about having the MFA trigger on all of their respective logins:

Enrollment and challenging an MFA factor are two distinct operations, due to that fact, after the user enrolls to the factors on their initial login, on their next one they will be asked to complete the MFA challenge and check the “Remember Browser for 30 days”.

After an user has been challenged and they tick that box on the respective login, any other logins on the respective device will not prompt the MFA to be triggered even if the action would challenge them to do so.

An alternative approach to this would be to set inside the metadata the specific time when they have completed the MFA challenge and trigger it again after a specific time frame (14 days/60 days/90 days).

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![daniel.bozinovski](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/daniel.bozinovski/32/71029_2.png) [@daniel.bozinovski](https://community.auth0.com/u/daniel.bozinovski)\
**Post date:** [July 14, 2025, 11:59pm UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011/6 "2025-07-14T23:59:37Z")

</div>

Hey @nik.baleca ,

Yeah correct, was when they’re already enrolled into a factor and want to enrol into a second factor and are being challenged even if they have `mfa` inside their `authentication.methods`.

Thought that would be the case that we would need to implement custom functionality.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [July 15, 2025, 4:10pm UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011/7 "2025-07-15T16:10:21Z")

</div>

Great I could help!

Just to provide more information on the matter, that error is being thrown because in order for a user to be able to enroll into a new MFA factor, an MFA token is required.  
If you attempt to enroll an user without having them log in or undergo an MFA challenge, this token will be missing and the error will be thrown. Because of that, if you wish to basically “bypass” a login process or an MFA challenge, you would need a custom implementation in which you generate the MFA token for the user and enroll them using the Authentication API.

Kind Regards,  
Nik

---

<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:** [July 29, 2025, 4:11pm UTC](https://community.auth0.com/t/mfa-need-to-challenge-user-with-existing-factor-before-enrolling-into-new-factor-even-if-already-been-challenged/189011/8 "2025-07-29T16:11:04Z")

</div>

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