# Email verification - always redirects to invalid link page

**URL:** <https://community.parseplatform.org/t/email-verification-always-redirects-to-invalid-link-page/3519>\
**Category:** REST API\
**Tags:** email-verification\
**Created:** [June 28, 2023, 2:07pm UTC](https://community.parseplatform.org/t/email-verification-always-redirects-to-invalid-link-page/3519 "2023-06-28T14:07:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![reptilehaus](https://community.parseplatform.org/user_avatar/community.parseplatform.org/reptilehaus/32/1259_2.png) [@reptilehaus](https://community.parseplatform.org/u/reptilehaus)\
**Post date:** [June 28, 2023, 2:07pm UTC](https://community.parseplatform.org/t/email-verification-always-redirects-to-invalid-link-page/3519/1 "2023-06-28T14:07:45Z")

</div>

Im using parse-server-api-mail-adapter

Password reset works but with email verification clicking the button in the email brings me to the invalid verification link page

The url in the emails button is formatted as follows where /v1/api/ is my parse mount point  
[http://127.0.0.1:1337/v1/api/apps/APPS\_NAME/verify\_email?token=Syiodr0LR6jtkeZaLz06DUhbT&username=me%2B874%40example.com](http://127.0.0.1:1337/v1/api/apps/APPS_NAME/verify_email?token=Syiodr0LR6jtkeZaLz06DUhbT&username=me%2B874%40example.com)

Im using this custom html template

```auto
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  </head>

  <body style="text-align: center">
    <p style="font-weight: bolder; font-size: large">Welcome!</p>
    <p>Click the button below to verify your email address:</p>
    <br />
    <p>
      <a
        href="{{{link}}}"
        style="
          background-color: lightskyblue;
          cursor: pointer;
          border-radius: 5px;
          padding: 10px;
          border-style: solid;
          border-width: 2px;
          text-decoration: none;
          font-weight: bolder;
          color: blue;
        "
      >
        Verify email
      </a>
    </p>
    <br />
  </body>
</html>

```

I am using CLP as follows

```auto
export const User = {
	className: '_User',
	fields: {
		email: { type: 'String' },
		authData: { type: 'Object' },
		emailVerified: { type: 'Boolean' },
		password: { type: 'String' },
		username: { type: 'String' },
		// firstname: { type: 'String' },
		// lastname: { type: 'String' },
		// picture: { type: 'File' },
		role: { type: 'Pointer', targetClass: '_Role' },
		profile: { type: 'Pointer', targetClass: 'Profile' },
	},
	classLevelPermissions: {
		find: { 'role:super': true },
		count: { 'role:super': true },
		get: { requiresAuthentication: true },
		update: { requiresAuthentication: false },
		create: { 'role:super': true },
		delete: { 'role:super': true },
		addField: {},
		protectedFields: {
			'*': ['authData', 'password', 'username'],
		},
	},
}

```

some excerpt from parse server config

```auto
verifyUserEmails: true,
serverURL: urls.internalParseUrl,
enforcePrivateUsers: false,
publicServerURL: urls.publicParseUrl,

```

Any Idea where I am going wrong with this ?

---

<div class="post-metadata">

**Author:** ![reptilehaus](https://community.parseplatform.org/user_avatar/community.parseplatform.org/reptilehaus/32/1259_2.png) [@reptilehaus](https://community.parseplatform.org/u/reptilehaus)\
**Post date:** [June 28, 2023, 4:18pm UTC](https://community.parseplatform.org/t/email-verification-always-redirects-to-invalid-link-page/3519/2 "2023-06-28T16:18:22Z")

</div>

After a ton of breakpoints in parse server figured out the issue is my CLP and protected fields, seems parses internal verifyEmail in UserController cant lookup the user if username is part of protected fields.

I kinda assumed user controller was using masterkey.

Hopefully helps someone else

---

<div class="post-metadata">

**Author:** ![Manuel](https://community.parseplatform.org/user_avatar/community.parseplatform.org/manuel/32/186_2.png) [@Manuel](https://community.parseplatform.org/u/Manuel)\
**Post date:** [December 29, 2024, 12:48pm UTC](https://community.parseplatform.org/t/email-verification-always-redirects-to-invalid-link-page/3519/3 "2024-12-29T12:48:44Z")

</div>

That sounds like a bug actually. Would you please open an issue in the GitHub repo?
