# Email verification for Enterprise users

**URL:** <https://community.auth0.com/t/email-verification-for-enterprise-users/28230>\
**Category:** Get Help\
**Created:** [July 19, 2019, 3:00pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230 "2019-07-19T15:00:28Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![asahyouni](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/asahyouni/32/42536_2.png) [@asahyouni](https://community.auth0.com/u/asahyouni)\
**Post date:** [January 11, 2023, 4:27pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/21 "2023-01-11T16:27:48Z")

</div>

BTW; you cannot map literals

```auto
"email_verified": true

```

for some reason.

---

<div class="post-metadata">

**Author:** ![yaser.alazm](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@yaser.alazm](https://community.auth0.com/u/yaser.alazm)\
**Post date:** [June 8, 2023, 1:32pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/22 "2023-06-08T13:32:23Z")

</div>

Any updates about this? users created with enterprise connection should be able to set as “email\_verified”: true. right now it’s not possible like any other mapping! also as mentioned before, mapping “email\_verified” attribute to literal true value is not setting the created users to verified after being created!

---

<div class="post-metadata">

**Author:** ![stephanie.akpakoun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.akpakoun/32/51895_2.png) [@stephanie.akpakoun](https://community.auth0.com/u/stephanie.akpakoun)\
**Post date:** [March 19, 2024, 3:47pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/23 "2024-03-19T15:47:06Z")

</div>

Bump. Any updates on this? Being able to set the value of the email verified flag by default for SAML connections is a must.

---

<div class="post-metadata">

**Author:** ![chris.haynes](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@chris.haynes](https://community.auth0.com/u/chris.haynes)\
**Post date:** [March 19, 2024, 9:14pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/24 "2024-03-19T21:14:12Z")

</div>

Same for us as well. Plus, mapping to a “truthy” value breaks the Golang client that expects an actual boolean.

---

<div class="post-metadata">

**Author:** ![omrig](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/omrig/32/17884_2.png) [@omrig](https://community.auth0.com/u/omrig)\
**Post date:** [April 12, 2024, 2:28am UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/25 "2024-04-12T02:28:56Z")

</div>

Ditto. This just broke one of our customers. The Auth0 Golang SDK requires “email\_verified” to be a boolean, and will fail when it’s a string.

---

<div class="post-metadata">

**Author:** ![will.laine](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/will.laine/32/56484_2.png) [@will.laine](https://community.auth0.com/u/will.laine)\
**Post date:** [April 17, 2024, 8:19pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/26 "2024-04-17T20:19:00Z")

</div>

Bump. Not being able to set “email\_verified” to true form SAML connections is breaking all of the Auth0 SDKs for reading users. We currently have to map to “[http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier](http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier)” but that is not a sufficient solution given the issue above.

---

<div class="post-metadata">

**Author:** ![gdrapers](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@gdrapers](https://community.auth0.com/u/gdrapers)\
**Post date:** [July 9, 2024, 10:58pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/27 "2024-07-09T22:58:29Z")

</div>

In case it can help anybody else, the workaround we ended up with is to wrap the resulting user list so we can use a custom unmarshal function.

```auto
// Specialized SAML user list function
//
// The Auth0 golang SDK does not properly handle the unmarshal of the returned payload into a management.UserList.
//
// The returned payload contains:
// "email":"user@domain.com",
// "emailVerified":"true",
// "email_verified":"user@domain.com"
//
// Which results in an unmarshal error when calling `func (m *UserManager) List(ctx context.Context, opts ...RequestOption) (ul *UserList, err error)`
// resulting in an error `strconv.ParseBool: parsing "user@domain.com": invalid syntax`
//
// The implementation below works around the issues by using custom JSON marshaling to map the values into the management.User instances.
type User struct {
	management.User
}

type UserList struct {
	management.List
	Users []*User `json:"users"`
}

func (ul UserList) UserList() []*management.User {
	return lo.Map(ul.Users, func(v *User, i int) *management.User { return &v.User })
}

func (u *User) UnmarshalJSON(b []byte) error {
	var raw map[string]interface{}

	if err := json.Unmarshal(b, &raw); err != nil {
		return err
	}

	verified := false
	if emailVerified, ok := raw["emailVerified"]; ok {
		verified, _ = strconv.ParseBool(emailVerified.(string))
	}

	delete(raw, "emailVerified")
	delete(raw, "email_verified")

	buf, err := json.Marshal(raw)
	if err != nil {
		return err
	}

	type tTmpUser User
	var tmpUser tTmpUser

	if err := json.Unmarshal(buf, &tmpUser); err != nil {
		return err
	}
	tmpUser.VerifyEmail = &verified

	*u = User(tmpUser)

	return nil
}

func ListUsers(ctx context.Context, m *management.Management, payload interface{}, options ...management.RequestOption) error {
	options = append(options,
		management.PerPage(100),
		management.IncludeTotals(true),
	)

	request, err := m.NewRequest(ctx, "GET", m.URI("users"), payload, options...)
	if err != nil {
		return fmt.Errorf("failed to create a new request: %w", err)
	}

	response, err := m.Do(request)
	if err != nil {
		return fmt.Errorf("failed to send the request: %w", err)
	}
	defer response.Body.Close()

	// If the response contains a client or a server error then return the error.
	if response.StatusCode >= http.StatusBadRequest {
		return err // newError(response) //TODO create correct error based on response
	}

	responseBody, err := io.ReadAll(response.Body)
	if err != nil {
		return fmt.Errorf("failed to read the response body: %w", err)
	}

	if len(responseBody) > 0 && string(responseBody) != "{}" {
		if err = json.Unmarshal(responseBody, &payload); err != nil {
			return fmt.Errorf("failed to unmarshal response payload: %w", err)
		}
	}

	return nil
}

```

Link to the code which deploys this for further detail:

> <https://github.com/aserto-dev/ds-load/blob/80f575235a3e3dd8e9d2c5d89b581f467576f75d/plugins/auth0/pkg/fetch/fetch.go#L314>

---

<div class="post-metadata">

**Author:** ![oidc\_guy](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@oidc\_guy](https://community.auth0.com/u/oidc_guy)\
**Post date:** [March 26, 2025, 1:58am UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/28 "2025-03-26T01:58:09Z")

</div>

In case it helps… if a goal is to send `email_verified: true` as an outbound ID token claim from Auth0 after users log in via the SAML connection, you can do that via a Post Login action like so:

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

if (event.connection.strategy === 'samlp' && event.connection.name === 'CONNECTION_NAME_HERE') {

api.idToken.setCustomClaim('email_verified', true);

}

};

```

---

<div class="post-metadata">

**Author:** ![sarah.hanley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sarah.hanley/32/48176_2.png) [@sarah.hanley](https://community.auth0.com/u/sarah.hanley)\
**Post date:** [July 15, 2026, 2:37pm UTC](https://community.auth0.com/t/email-verification-for-enterprise-users/28230/29 "2026-07-15T14:37:20Z")

</div>

Bumping this again as it is still an issue! Why is there not a set email\_verified: true option like there is for all the other enterprise connection types? why is there no way to manually set these users to verified with the API? This is causing massive frustration for our customers.

[Previous page](https://community.auth0.com/t/email-verification-for-enterprise-users/28230.md?page=1)
