Hello guys, I’m new to this and I’m just trying to fetch some data using the API, but I keep receiving error 401. My Client-ID is correct, I don’t know what else it could be. Can you guys see if there is something wrong with my code?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
function GetGame(){
var result = [];
$.ajax({
type: 'GET',
url: 'https://api.twitch.tv/helix/streams?game_id=33214',
headers: {
"Client-ID" : "MY_ID_HERE",
"Accept": "application/vnd.twitchtv.v5+json"
},
success: function(json) {
result.push(json.streams);
console.log(json);
console.log(result);
}});
return result;
}
GetGame();
</script>