Trying to connect an IoT device to Twitch to get stream status

if I run

curl -X POST "https://id.twitch.tv/oauth2/token?client_id=MYID&client_secret=MYSECRET&grant_type=client_credentials"

my result is.

And if I used real creds, I get a token JSON blob

So I have no idea why you are getting HTML and a 400

As your request looks correct