# Netlify Identity Returning Malformed JSON Response

**URL:** <https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529>\
**Category:** Support\
**Tags:** identity\
**Created:** [June 14, 2023, 4:52pm UTC](https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529 "2023-06-14T16:52:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jadamconnor](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jadamconnor/32/33639_2.png) [@jadamconnor](https://answers.netlify.com/u/jadamconnor)\
**Post date:** [June 14, 2023, 4:52pm UTC](https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529/1 "2023-06-14T16:52:51Z")

</div>

Netlify Site Name: peaceful-mccarthy-2e0b38

Hi, I’m using Netlify Identity, and new users are unable to register because email verification is failing. When users attempt to verify their email, the POST to /.netlify/identity/verify fails with the message, “Webhook returned malformed JSON: invalid character ‘\<’ looking for beginning of value”.

Interestingly, allowing auto-confirm of email addresses causes this error to occur at time of sign-up rather than at confirmation.

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [June 16, 2023, 9:35pm UTC](https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529/2 "2023-06-16T21:35:13Z")

</div>

This almost certainly means that you are receiving an HTML rather than JSON response. Have you tried POSTing to your endpoint yourself, to see what happens? Perhaps you get a “page not found” or instead a “permission denied”, or even a “syntax error” - all of which will return HTML resources even at a dynamic path that you expect to return JSON (if it ran correctly).

If you do the POST yourself from code, I suppose you can test like that and see what is coming back.

If not, but you can catch it happening in a HAR file (cf [HAR Analyzer](https://toolbox.googleapps.com/apps/har_analyzer/)), perhaps we can help understand what is happening through that view.

Or, perhaps we can reproduce by ourselves - I see you have open invites for identity on - by inviting ourselves to your instance? What’s the preferred path to do that, if that’s how you’d like us to approach it?

---

<div class="post-metadata">

**Author:** ![jadamconnor](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jadamconnor/32/33639_2.png) [@jadamconnor](https://answers.netlify.com/u/jadamconnor)\
**Post date:** [July 11, 2023, 3:26pm UTC](https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529/4 "2023-07-11T15:26:09Z")

</div>

Hello! I apologize for the delayed response.

This is a little confusing to me, as it’s Netlify’s endpoint, not ours. And it’s Netlify’s identity widget library that determines the endpoint when `/#confirmation_token=xxxxxxxxxxxxx` is added to the end of our url.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 16, 2023, 12:47pm UTC](https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529/5 "2023-07-16T12:47:16Z")

</div>

You’ve set a custom webhook: [Identity | Site configuration | peaceful-mccarthy-2e0b38 | Netlify](https://app.netlify.com/sites/peaceful-mccarthy-2e0b38/configuration/identity#webhook) that’s sending HTML, not Netlify.

---

<div class="post-metadata">

**Author:** ![jadamconnor](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jadamconnor/32/33639_2.png) [@jadamconnor](https://answers.netlify.com/u/jadamconnor)\
**Post date:** [July 16, 2023, 5:58pm UTC](https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529/6 "2023-07-16T17:58:30Z")

</div>

Hello. Thanks for your response. Removing this webhook indeed resolves the issue. But this webhook is simply to notify an administrator that a user has registered. It sends the user metadata to an endpoint. I don’t understand why that would interfere with the registration process. Also, this worked as is for a long time. Has something changed?

Additionally, I’m noticing now that if I disable auto-confirm (enable confirmation emails), Netlify is sending the HTML of the path specified to the email address. That wasn’t working like that before. It used to send a link to the site with a token param.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 16, 2023, 6:11pm UTC](https://answers.netlify.com/t/netlify-identity-returning-malformed-json-response/94529/7 "2023-07-16T18:11:55Z")

</div>

> [@jadamconnor](#):
>
> I don’t understand why that would interfere with the registration process.

The webhook is supposed to return a 200, 202 or 204. If it returns a 200, we expect a JSON payload of the user that needs to be encoded as JWT. Since we expect JSON, you send HTML, it doesn’t work.

> [@jadamconnor](#):
>
> Also, this worked as is for a long time.

I’d hardly think so. Identity hasn’t changed for a long time.

> [@jadamconnor](#):
>
> Netlify is sending the HTML of the path specified to the email address.

You seem to have set the confirmation template:

![image](https://global.discourse-cdn.com/netlify/original/3X/e/2/e25577f1c4ed2932ff50efd9f3c5696314f649a0.png)

Read here: [Identity-generated emails | Netlify Docs](https://docs.netlify.com/visitor-access/identity/identity-generated-emails/#custom-templates)
