I´m trying to do a small pull with the twitch api to find out the users that is subscribers.
$client_id = 123456132456132456;
$secret_client = '132456132456132456';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.twitch.tv/kraken/channels/twitch_user/subscriptions');
curl_setopt($ch, CURLOPT_HEADER, 0);
$headers = array(
'Accept: application/vnd.twitchtv.v3+json',
'Authorization: OAuth '.$secret_client
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$retval = curl_exec($ch);
curl_close ($ch);
$result = json_decode($retval, true);
echo '<pre>';
var_dump($result);
echo '</pre>';
What is the OAuth key? Is it “Secret clinet” key or the “Client ID” key?
I have tryed with both and none of the works. I ony got 401 - Token invalid or missing required scope
I have tryed this also trough a CLI and same there 401 - Token invalid or missing required scope
Could it be that the script wants something else then a string for the OAuth? I´m out of ideas
Br Tomas