I'm trying to fetch information from twitch api. The problem is that I have to include my client ID when requesting, otherwise it gives HTTP 400 error.
From https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api: "To identify your application to the API, every request must include your application’s client ID, either explicitly or implicitly by including an OAuth token. If you use an OAuth token in your request, the API figures out the client ID for you.
Requests can include both a client ID and an OAuth token. Requests without either one fail with an HTTP 400 error."
I'm using node-fetch:
fetch('https://api.twitch.tv/kraken/streams/lirik')
.then(function(res) {
if(res.stream===null){
console.log("Offline");
}
else{
console.log("ONLINE!");
}
console.log(res.stream);
return res.json();
});
via Smil3
No comments:
Post a Comment