# Disable Email Verification In Pre-User-Registration Trigger

**URL:** <https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634>\
**Category:** Get Help\
**Tags:** email-verification, user-management\
**Created:** [January 6, 2025, 6:14pm UTC](https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634 "2025-01-06T18:14:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jibrazil](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jibrazil/32/33961_2.png) [@jibrazil](https://community.auth0.com/u/jibrazil)\
**Post date:** [January 6, 2025, 6:14pm UTC](https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634/1 "2025-01-06T18:14:47Z")

</div>

I’m trying to prevent the user email verification for users in a pre-registration trigger. The idea is that I want to pass a flag to the trigger in the meta data that would allow us to automatically verify the users email and NOT send the verification email.

Here’s what I want to do in psuedo code:

if ( event.user.user\_metadata?.SkipEmailVerification == true )  
{  
event.user.verify\_email = false;  
event.user.email\_verfied = true;  
}

I’m unable to find a way to modify these properties in my trigger.

Thanks

---

<div class="post-metadata">

**Author:** ![sumansaurav](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sumansaurav/32/70627_2.png) [@sumansaurav](https://community.auth0.com/u/sumansaurav)\
**Post date:** [January 6, 2025, 7:19pm UTC](https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634/2 "2025-01-06T19:19:33Z")

</div>

You are trying to update user fields before user is even registered using pre-user-registration action. I am not sure, if this is even possible. You can likely use post-registration-action and update user call to set this field to verified.

> [@Updating User Profile from Actions](https://community.auth0.com/t/updating-user-profile-from-actions/85206):
>
> I am wondering if anyone has had any success in updating the users profile from an action. In particular, I would like to use a URL based API to gather that information in the login process. I can get the data from the API, but it seems I can only find documentation on updating the user and app metadata. I would like to update the family\_name and given\_name of the profile. Thanks, Mark

```auto
// Use a post-registration trigger instead
// This is often more permissive with user modifications
exports.postRegistrationHandler = async (event, context) => {
  if (event.user.user_metadata?.skipEmailVerification) {
    // Use the link above to build your auth0 update API call.
    await auth.updateUser(event.user.id, {
      emailVerified: true
    });
  }
};

```

---

<div class="post-metadata">

**Author:** ![jibrazil](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jibrazil/32/33961_2.png) [@jibrazil](https://community.auth0.com/u/jibrazil)\
**Post date:** [January 6, 2025, 7:57pm UTC](https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634/4 "2025-01-06T19:57:15Z")

</div>

Thanks Suman,

It makes sense what you are saying about the prereg trigger. I’ll try what you’ve suggested in my exports.onExecutePostUserRegistration trigger.

---

<div class="post-metadata">

**Author:** ![jibrazil](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jibrazil/32/33961_2.png) [@jibrazil](https://community.auth0.com/u/jibrazil)\
**Post date:** [January 6, 2025, 8:27pm UTC](https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634/5 "2025-01-06T20:27:09Z")

</div>

I’m having an issue with the update user method. Here’s my code

```auto
    const ManagementClient = auth0Sdk.ManagementClient;
       
    const management = new ManagementClient({
      domain: event.secrets.DOMAIN,
      clientId: event.secrets.CLIENT_ID,
      clientSecret: event.secrets.CLIENT_SECRET,
      audience: 'https://' + event.secrets.DOMAIN + '/api/v2/',
      tokenProvider: {
        enableCache: true,
        cacheTTLInSeconds: 10
      }
    });

    const params = { id: event.user.user_id};

    const data = {
      emailVerified: true 
    }
 
 
    try {
        const res = await management.updateUser(params, data) 
      } 
      catch (e) {
        console.log(" ERROR: " + e)
 
      }
 

```

But I’m getting the following error: ERROR: TypeError: management.updateUser is not a function.

Any ideas on what wrong here, would be appreciated.

---

<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:** [January 6, 2025, 8:33pm UTC](https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634/6 "2025-01-06T20:33:11Z")

</div>

Hi @jibrazil,

Unfortunately, as @sumansaurav mentioned, you won’t be able to disable the email verification using a pre-user registration Action. Additionally, the post-user registration Action will not work here either since it happens after the user is created.

Note that after a user is created, it will automatically send the welcome email and verification email (if enabled). Therefore, the only way to ensure that the verification email is not sent is to create the users manually using the Management API’s [create a user endpoint](https://auth0.com/docs/api/management/v2/users/post-users) and passing in the `verify_email=false` body parameter.

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:** [January 20, 2025, 8:34pm UTC](https://community.auth0.com/t/disable-email-verification-in-pre-user-registration-trigger/167634/7 "2025-01-20T20:34:07Z")

</div>

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