Getting Sub List with Helix return 404 (ajax)

Hi all,

trying to get my channel sublist through helix api, but the ajax request give me a “404 Not found” return error.
This script is running on my local webserveur (httpd).

Here is my code :

$.ajax({
 type: 'POST',
 url: 'https://api.twitch.tv/helix/subscriptions?broadcaster_id=MYCHANNELNAME',
 headers: {
   'Authorization': 'Bearer MYTOKEN',
   'Client-ID': 'MYCLIENTID'
 },
 success: function(data) {
	alert('success');
 },
error: function (request, error) {
   		alert(" Can't do because: " + error);
    	console.log(arguments);

	}
});

Is there some problem running twitch api on localhost ?
The httpd server on witch this script is running works with ssl and a self signed ssl certificate, is it a problem ?
Can’t find any a solution matching my problem on the web.

You POST’ed instead of GET’ed

Thx for your reply.
How i couldn’t see it…

With a GET request, now the helix api return an “Unauthorized” error.
Even if i refresh my token with the “channel:read:subscriptions” scope, still the same error.
This is my very first time with twitch api, so i don’t understand yet all the subtleties.

I hope not making a mistake with the “broadcaster_id” parameter, witch for me is my channel name (lowercase).

You did generate a user access token and not a server access token?

If you call https://dev.twitch.tv/docs/authentication#validating-requests with your token, if the return contains a user_id you have the correct kind of token.

Otherwise you need to generate a user token https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-authorization-code-flow

  • This applies for most use cases

Everything works fine with the GET request and fresh token.

Thx again.

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