Error with Client-ID

I have been coding with jQuery ajax trying to retrieve a channel based off of the OAuth token as seen here.

$.ajax({ url: '', type: 'GET', contentType: 'application/json', dataType: 'jsonp', headers: { 'Client-ID': 'xxx', 'Authorization': token } });

and I receive the error

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

How would I be able to fix this, why am I getting this error?

It looks like you set up your headers wrong. Twitch does not recognize the Authorization header, instead you put the OAuth token (without the oauth: prefix) under Client-ID. Hope my suggestion helps. :wink:

Authorization should be 'OAuth ’ + token instead, and you should use a valid client id from an application you registered.

I have a vaild Client-ID I just chose to not show it here, because I know what mine is and how to get it.

What do you mean by this, if so could you show me an example?

It should look like this:

headers: {
      'Client-ID': 'your OAuth token here'

The rest of your code looks fine to me

I still got the same error, and I have refreshed the caches of the site. Plus when I look at the Docs locatated here it tells me that I need the Authorization, Client-ID, and the Accept Headers

I just looked at the docs and you’re right: it needs an extra OAuth token for the Authorization header. I’ve tested it myself using the same exact Client ID and got a 404 error. I don’t know how this works exactly, but there’s an alternative method:

  1. Get the username’s ID with this URL:
  2. Use that same user ID to get its info, for example,

It should give you the exact output without the account’s email address, obviously for security reasons. Apologies if it isn’t related, but I find it easier that way.

@TrainerTimmy Watch the terminology. Client-ID and OAuth token are not the same.


Oh, thanks for pointing that out! :stuck_out_tongue:

@GrimtrisharaLok Try reading this:

You can easily get an OAuth token at Don’t worry about the name, just about any valid OAuth token linked to an account should work.

Try this

    url: '',
    type: 'GET',
    contentType: 'application/json',
    dataType: 'json',
    headers: {
      'Client-ID': '<your client id>',
      'Authorization': 'OAuth <your oauth token with channel_read scope>',
      'Accept': 'application/vnd.twitchtv.v5+json'

I removed dataType: jsonp since Kraken supports CORS so there isn’t much of a need for jsonp. Also, I don’t think that works with headers, added the Accept header to specific the latest API version, and also changed the url to remove the “s” in channels. I think there is an error in the v5 docs since this request was singular in previous API versions.

@TrainerTimmy is only for generating a token capable of logging into IRC. It will not have the necessary scopes to make the request @GrimtrisharaLok is trying to do.


Thank you so much @george the issue is now resolved :smiley:

@george :thumbsup:

dataType json should only make jquery do the JSON.parse for you. jsonp is different.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.