# Email Verified for Connection via Rules

**URL:** <https://community.auth0.com/t/email-verified-for-connection-via-rules/38808>\
**Category:** Get Help\
**Tags:** rules\
**Created:** [March 3, 2020, 4:37pm UTC](https://community.auth0.com/t/email-verified-for-connection-via-rules/38808 "2020-03-03T16:37:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jreed](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jreed/32/19533_2.png) [@jreed](https://community.auth0.com/u/jreed)\
**Post date:** [March 3, 2020, 4:37pm UTC](https://community.auth0.com/t/email-verified-for-connection-via-rules/38808/1 "2020-03-03T16:37:03Z")

</div>

I have SAML connection and when it comes in the Email is not marked as verified. I saw this other question that says I should be able to do it via rules:

> [@Auto email\_verified when social or saml connection](http://community.auth0.com/t/auto-email-verified-when-social-or-saml-connection/28416):
>
> Hi I want to use the link account rule as is - problem is that one of the conditions are that the email was verified , but for saml connection users emails are never verified. yes i know i can change the rule - but i thought it make more sense to say hey - someone already verified them , this is why i have a trust with them so how can i change user profile upon login to be email\_verified only for saml connections or social thanks Shlomi

But it seems like email\_verified doesn’t get set via rules:

```
function (user, context, callback) {
    user. email_verify = true;
    user.email_verified = true;
    callback(null, user, context);
}

```

^-- with that code I see that the `email_verify` does get set properly, but `email_verified` does not get updated to true. Is it a special case I need to edit in a different way?

---

<div class="post-metadata">

**Author:** ![rashid779939](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rashid779939/32/27027_2.png) [@rashid779939](https://community.auth0.com/u/rashid779939)\
**Post date:** [March 4, 2020, 5:56am UTC](https://community.auth0.com/t/email-verified-for-connection-via-rules/38808/2 "2020-03-04T05:56:33Z")

</div>

Hi @jreed,

Welcome to the Community

Please see below documentation to update user at auth0

> **[Update User Profiles Using Your Database](https://auth0.com/docs/manage-users/user-accounts/user-profiles/update-user-profiles-using-your-database)**
>
> Learn how to update user profiles when using your own database as an identity provider.

---

<div class="post-metadata">

**Author:** ![aamarfii](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aamarfii/32/19535_2.png) [@aamarfii](https://community.auth0.com/u/aamarfii)\
**Post date:** [March 4, 2020, 12:57pm UTC](https://community.auth0.com/t/email-verified-for-connection-via-rules/38808/3 "2020-03-04T12:57:24Z")

</div>

The question is if it’s possible to update the `user.email_verified` property using Rules.

For some reasons you can update `user.nickname` or `user.email` using javascript rules, but not `user.email_verified`.

I could not find any answer to this in documentation you referenced.

---

<div class="post-metadata">

**Author:** ![rashid779939](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rashid779939/32/27027_2.png) [@rashid779939](https://community.auth0.com/u/rashid779939)\
**Post date:** [March 8, 2020, 5:26am UTC](https://community.auth0.com/t/email-verified-for-connection-via-rules/38808/4 "2020-03-08T05:26:36Z")

</div>

Hi All, Apology for delay in response:

You can set this field value in rule by calling patch API. See below code for reference:

```
function (user, context, callback) {
  const request = require('request');
  const userApiUrl = auth0.baseUrl + '/users/';
  //Your baseURL will be like this https://tenantName.domain-name.auth0.com/api/v2

  // Set email verified if a user has already updated his/her password
  request.patch({
    url: userApiUrl + user.user_id,
    headers: {
      Authorization: 'Bearer ' + auth0.accessToken
    },
    json: { email_verified: true },
    timeout: 5000
  },
  function(err, response, body) {
// return in case of success
    return callback(null, user, context);
  });
}

```

---

<div class="post-metadata">

**Author:** ![mathiasconradt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathiasconradt/32/12758_2.png) [@mathiasconradt](https://community.auth0.com/u/mathiasconradt)\
**Post date:** [March 8, 2020, 9:19am UTC](https://community.auth0.com/t/email-verified-for-connection-via-rules/38808/5 "2020-03-08T09:19:34Z")

</div>

As @rashid779939 said.

And the documentation for this is at [Auth0 Management API v2](https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id)

> Update a user.  
> These are the attributes that can be updated at the root level:  
> …  
> email\_verified  
> …

---

<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:** [March 23, 2020, 9:19am UTC](https://community.auth0.com/t/email-verified-for-connection-via-rules/38808/6 "2020-03-23T09:19:40Z")

</div>

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