hey all, have a error: "error" => "Unauthorized" "status" => 401 "message" => "Missing scope: channel:read:subscriptions or channel_subscriptions" ]
my code:
$client_id = 'id';
$client_secret = 'secret';
$url = 'https://id.twitch.tv/oauth2/token';
$data = array('client_id' => $client_id, 'client_secret' => $client_secret, 'grant_type' => 'client_credentials', 'scope' => 'channel:read:subscriptions');
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = json_decode(file_get_contents($url, false, $context), true);
if (isset($result['access_token'])) {
$token = $result['access_token'];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.twitch.tv/helix/subscriptions?broadcaster_id=jankos',
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_TIMEOUT => 1,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Client-Id: ' . $client_id
]
]
);
$res = json_decode(curl_exec($curl), true);
where is my fail? ty for answer