as per OIDC Authorization - Bad Request - PHP
Check your headers are right.
Personally I’m running (for nodeJS Express/Request)
var code = req.query.code ? req.query.code : false;
request.post({
url: 'https://api.twitch.tv/api/oauth2/token'
+ '?client_id=' + config.twitch.client
+ '&client_secret=' + config.twitch.secret
+ '&code=' + code
+ '&grant_type=authorization_code'
+ '&redirect_uri=' + config.twitch.redirect,
headers: {
'Accept': 'application/json'
},
gzip: true,
json: true
}, function(e, r, b) {
if (e) {
console.log(e);
return;
} else if (r.statusCode == 200) {