# \[Solved\] Update user with Actions - including email\_verified

**URL:** <https://community.auth0.com/t/solved-update-user-with-actions-including-email-verified/123818>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [December 28, 2023, 7:58pm UTC](https://community.auth0.com/t/solved-update-user-with-actions-including-email-verified/123818 "2023-12-28T19:58:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandro.oliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexandro.oliveira/32/48573_2.png) [@alexandro.oliveira](https://community.auth0.com/u/alexandro.oliveira)\
**Post date:** [December 28, 2023, 7:58pm UTC](https://community.auth0.com/t/solved-update-user-with-actions-including-email-verified/123818/1 "2023-12-28T19:58:35Z")

</div>

Hi,

While navigating through the forum, I came across some topics that demonstrate the outdated method for updating user information. (e.g [Auth0's Management API v2 to update user profile](https://community.auth0.com/t/auth0s-management-api-v2-to-update-user-profile/73113))

Here is how i implemented step-by-step:

In the PostLogin you will see this snippet:

```auto
exports.onExecutePostLogin = async (event, api) => {
}

```

so, you can get your credentials on: [https://manage.auth0.com/dashboard/eu/TENENT\_NAME/applications/APP\_ID/credentials](https://manage.auth0.com/dashboard/eu/TENENT_NAME/applications/APP_ID/credentials)

after that, you can instance

```auto
const ManagementClient = require('auth0').ManagementClient;
        
const management = new ManagementClient({
            domain: event.secrets['AUTH0_DOMAIN'],
            clientId: event.secrets['AUTH0_CLIENT_ID'],
            clientSecret: event.secrets['AUTH0_CLIENT_SECRET']
});

```

Create the body you want to update: ([Auth0 Management API v2](https://auth0.com/docs/api/management/v2/users/patch-users-by-id))

```auto
const data = { email_verified: true };

```

create the params: ([PatchUsersByIdRequest | auth0](https://auth0.github.io/node-auth0/interfaces/management.PatchUsersByIdRequest.html))

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

```

then:

```auto
await management.users.update(params, data)

```

full code:

```auto
exports.onExecutePostLogin = async (event, api) => {
   const ManagementClient = require('auth0').ManagementClient;
    const management = new ManagementClient({
            domain: event.secrets['AUTH0_DOMAIN'],
            clientId: event.secrets['AUTH0_CLIENT_ID'],
            clientSecret: event.secrets['AUTH0_CLIENT_SECRET']
    });
  

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

   try {
            await management.users.update(params, data)
        } catch (e) {
       // handle
    }
}

```

Hope help community

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [December 30, 2023, 2:52am UTC](https://community.auth0.com/t/solved-update-user-with-actions-including-email-verified/123818/2 "2023-12-30T02:52:21Z")

</div>

Hi @alexandro.oliveira

Thank you for providing solutions for other community members. I’ve saved your post, and make sure to link other community members to it in case they need it. Team Work 😃

Thanks

Dawid

---

<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 13, 2024, 2:52am UTC](https://community.auth0.com/t/solved-update-user-with-actions-including-email-verified/123818/3 "2024-01-13T02:52:26Z")

</div>

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