I am trying to send a valid challenge response but they always fail because the Content-Type header field does not match what is expected:
$ twitch event verify-subscription subscribe -F https://xxxxxx/test -s dfsion43jdghjyt5mry
✔ Valid response. Received challenge 026c15d4-1c35-9ded-09e2-0905f1611983 in body
✗ Invalid content-type header. Received type text/html; charset=utf-8
✔ Valid status code. Received status 200
If I do not include the Content-Type header it will also fail:
$ twitch event verify-subscription subscribe -F https://xxxxxx/test -s dfsion43jdghjyt5mry
✔ Valid response. Received challenge 2231fa97-91fe-9bbb-f938-2153bc17b5cc in body
✗ Invalid content-type header. Received type
✔ Valid status code. Received status 200
In total I’ve tried text/plain, text/html, application/json, and application/octet, basically experimenting with different values. They all fail.
Everything is working correctly except for the Content-Type. This isn’t mentioned in the docs so I don’t understand why it’s even being considered.
I tried ignoring what the twitch-cli was saying and attempted to subscribe to the event, but those still failed, presumably for the same reason. (I’m not aware of a way to retrieve the failure reason.)
At this point I am stuck and don’t know what to do.
Something is appending a charset=utf-8 to your intended content-type, in your code.
Which is invalid for the CLI and eventsub.
The API will only report that it failed, not why. Thats what the CLI is for in this case.
You could (in error) conceivable return the signature as JSON in error with a JSON header, when it should be plain text. So it’s a “make sure the dev didn’t make a mistake”
Verify needs 200 + the challenge in plain text
Events need 200 ok or 204 No Content. (No Content will mean no content-type header to muck about with)
$ twitch event verify-subscription subscribe -F https://xxxxxx/test -s dfsion43jdghjyt5mry
✔ Valid response. Received challenge 7087e388-ff86-e86e-2763-dc3beb3aa02c in body
✗ Invalid content-type header. Received type text/html; charset=utf-8
✔ Valid status code. Received status 200
There is no charset being set anywhere in my code.
The CLI only reports the headers that your server returns.
The CLI itself doesn’t add headers.
You can test header response your senf by makign a curl request to your own server or using a HTTP Testing tool such as postman or insomnia and confirm it’s not the CLI at fault, since the CLI doesn’t add headers it only reports what your server returns.
This could be being added by nginx/apache or whatever is in front of your c code (if anything).
Hey
Are there any plans for making changes so that UTF-8 can be accepted? I’m using laravel and there’s no way to remove charset=UTF-8 because it’s added last minute if it’s missing from content-type.