# Conditionally require user to register and use MFA based on user attributes

**URL:** <https://community.auth0.com/t/conditionally-require-user-to-register-and-use-mfa-based-on-user-attributes/196729>\
**Category:** Get Help\
**Tags:** signup-prompt-new-experience, login-experience\
**Created:** [January 29, 2026, 3:14pm UTC](https://community.auth0.com/t/conditionally-require-user-to-register-and-use-mfa-based-on-user-attributes/196729 "2026-01-29T15:14:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JFoxUK](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jfoxuk/32/78058_2.png) [@JFoxUK](https://community.auth0.com/u/JFoxUK)\
**Post date:** [January 29, 2026, 3:14pm UTC](https://community.auth0.com/t/conditionally-require-user-to-register-and-use-mfa-based-on-user-attributes/196729/1 "2026-01-29T15:14:17Z")

</div>

Hi,

Is it possible to conditionally require user to register on signup and use on login MFA based on user attributes?

This similar post - [Prompt MFA based on user Meta Data - #4 by markd](https://community.auth0.com/t/prompt-mfa-based-on-user-meta-data/13562/4) has a broken doc link [Page Not Found](https://auth0.com/docs/multifactor-authentication/user-initiated-mfa?_gl=1*39emv1*_gcl_aw*R0NMLjE3Njk2OTUxNzQuQ2owS0NRaUFwLXpMQmhEa0FSSXNBQmNZYzZzTk9DSk5aeXl0SUdVUHVqWVJaMU1NemRPNEw2Y3VkTzJ3Ynh0WXBfaEUxb19mZ09CeExPQWFBa2tTRUFMd193Y0I.*_gcl_au*MTAwNDcxNDg3OC4xNzY0MzQ0ODk2*_ga*ODY4ODc5NzczLjE3NjQzNDQ4OTY.*_ga_QKMSDV5369*czE3Njk2OTc4MDYkbzQkZzEkdDE3Njk2OTk0NzEkajQ2JGwwJGgw)

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [January 29, 2026, 4:50pm UTC](https://community.auth0.com/t/conditionally-require-user-to-register-and-use-mfa-based-on-user-attributes/196729/3 "2026-01-29T16:50:09Z")

</div>

Hi again @JFoxUK,

Long time no see

Yes, you can trigger MFA and specific registration requirements conditionally based on user attributes. The modern way to achieve this in Auth0 is through **Auth0 Actions** , specifically using the [**Post-Login**](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa/customize-adaptive-mfa) to customize the MFA, and [**Pre-User Registration**](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/pre-user-registration-trigger). These allow you to execute custom JavaScript logic during the authentication process.

Example of Post Login for customizing MFA:

```javascript
exports.onExecutePostLogin = async (event, api) => {
  // Check if the user has a specific attribute in metadata
  if (event.user.user_metadata && event.user.user_metadata.requires_mfa === true) {
    api.authentication.enrollWith({ type: 'otp' }); // Force enrollment if not enrolled
    api.multifactor.enable('any'); // Trigger MFA
  }
};

```

Example of Pre User Registration

```javascript
exports.onExecutePreUserRegistration = async (event, api) => {
  const { user } = event;
  
  // Example: Block registration if a required attribute is missing
  if (!user.user_metadata || !user.user_metadata.department) {
    api.access.deny('Registration failed', 'A department attribute is required to register.');
  }
};

```

If you have any further questions, please don’t hesitate to reach out.

Have a good one,  
Vlad

---

<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:** [February 12, 2026, 4:50pm UTC](https://community.auth0.com/t/conditionally-require-user-to-register-and-use-mfa-based-on-user-attributes/196729/4 "2026-02-12T16:50:18Z")

</div>

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