Show last follow (php)


for several months the display has no longer worked.
before, I use’.TWITCH_ID but now show error.
now I want test with’.TWITCH_ID;

$ch = curl_init("".CLIENT_ID."&client_secret=".CLIENT_SECRET."&grant_type=client_credentials");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json'
  $response = curl_exec($ch);
  $data = json_decode($response, true);

$ch = curl_init(''.TWITCH_ID);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Client-ID: ' . CLIENT_ID,
    'Authorization: Bearer ' . $data['access_token']

$r = curl_exec($ch);
$i = curl_getinfo($ch);

The code return this, my array is empty

Thanks for your help

You have the wrong token type

The new follows API requires authentication from the broadcaster with the relevant scope attached

See Reference | Twitch Developers for scope requirements

For your use case you would normally use a code flow token Getting OAuth Access Tokens | Twitch Developers

Alternately after getting broadcaster permission you can use EventSub and Twitch will tell you the new follow(s) - EventSub Subscription Types | Twitch Developers

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