I ran this but when I do a console log nothing is returned
function twitchApiPost()
{
let options = {
hostname: 'id.twitch.tv',
path: `/oauth2/token?client_id=${config.twitchClientID}&client_secret=${config.twitchClientSecret}&grant_type=client_credentials`,
method: 'POST'
}
https.request(options, (res) => {
let body = '';
res.on('data', (chunk) => {
body += chunk;
console.log(body);
});
res.on('end', () => {
let json;
try
{
json = JSON.parse(body);
console.log(json);
}
catch(err)
{
console.log(err);
return;
}
if(json.status === 404)
{
console.log('404');
}
})
});
}