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, '');
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>';
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

The OAuth key is obtained individually for each user that is connected to your application, you can read about how to get them in the authentication documentation.

The authentication lets the application use the API on behalf of a specific user. You need to be authorized on behalf of the user whose subscribers you want to access.

Are you trying to get a list of all the users who have the subscription option or all the subscribers in a particular stream?

I´m trying to get fetch all the users that is subscriber so i can sync it with some other applications.