‘Authorization’: 'Bearer ’ + addJWT()
Looks to be the only issue, and you are getting a slightly confusing error response. As it’s parsing the Bearer/JWT and determining the ClientID from that. You should probably add an Accept header also
NodeJS Sample:
var payload = JSON.stringify({foo: 'bar'});
request.post({
url: 'https://api.twitch.tv/kraken/extensions/message/' + config.twitch.streamer_id,
headers: {
'Accept': 'application/vnd.twitchtv.v5+json',
'Authorization': 'Bearer ' + sig,
'Client-ID': client_id,
'Content-Type': 'application/json'
},
body: JSON.stringify({
message: payload,
content_type: 'application/json',
targets: ['broadcast']
}),
gzip: true
}, function(e, r, b) {
~SNIP~