Why is the Twitch API not recognizing this Client-ID?

Why is the Twitch API not recognizing this Client-ID?
0

#1

I am trying to get the Ajax GET to work, but it’s not recognizing the client ID in the header. Here’s what I have:

$.ajax({ type: 'GET', url: 'https://api.twitch.tv/kraken/', dataType: 'jsonp', headers: { 'Client-ID': 'fobdilcs5alzhn5k0x9jn377pu7yxuh' }, success: function(data) { console.log(data); } });

It’s giving me:

Object { error: "Bad Request", message: "No client id specified", status: 400 }

I know they’ve been making a lot of API changes, but seems to be the most up to date from what I’ve found. What am I missing?


#2

Try generating a new client id. It tells me that the token is invalid.


#3

Thanks, @PortableStick. I tried your suggest and it still wasn’t working.

But I did get it to work by passing the client_id as a token in the url:

$.ajax({ type: 'GET', url: 'https://api.twitch.tv/kraken/?client_id=fobdilcs5alzhn5k0x9jn377pu7yxuh', dataType: 'jsonp', success: function(data) { console.log(data); } });

I don’t understand why it wasn’t working properly before. I am wondering if my first method of passing headers does not work with Twitch’s API.


#4

According to their own staff member, that’s exactly how it should work. My app still works, so I’m not at all sure what the deal is. It may be an issue with CodePen.


#5

Thanks for taking a look.It’s mildly frustrating not understanding why an implementation is not working, but happy to have it working in some way. Maybe when I have time I will copy it off CodePen and see if that was it.