Twitch API - Access-Control-Allow-Origin

Twitch API - Access-Control-Allow-Origin
0

#1

Hi,

I’m not able to get the data for the twitch api challenge. It keeps giving me the “Access-Control-Allow-Origin” error. This is the code I’m using:

$(document).ready(function() {
  var baseURL = "https://wind-bow.glitch.me/";
  var twitch_users = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
  var stream_info = [];
  var twitchStreamURL = baseURL + "streams/";
  var twitchUserURL = baseURL + "users/";
  var twitchChannelURL = baseURL + "channels/";
  $.each(twitch_users, function(index, name) {
    $.ajax(twitchStreamURL + name + "?callback=?", {
      type: "GET",
      success: function(json) {
        console.log(json);
      }
    });
  });
});

#2

Got it working. I was forgetting “twitch-api” and I took out “?callback=?”.