Hi all,
There’s quite a few posts about missing bearer tokens and such, and I thought I had this whole authentication thing down (have written quite a few Twitch scripts already).
Now I wish to test if my ‘webhook subscriptions’ are registering.
My PHP code:
$api_endpoint = 'https://api.twitch.tv/helix/webhooks/subscriptions?first=100';
$headers = array(
'Authorization: Bearer << bearer token here >>',
'Client-ID: << client-ID here >>'
);
$options = array(
CURLOPT_URL => $api_endpoint,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true
);
$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
curl_close($ch);
The response:
“{“error”:“Unauthorized”,“status”:401,“message”:“Must provide valid app token.”}”
I’m sure the Bearer token is valid, and so is the Client-ID.
I have several scripts running that verify the exact same way, succesfully…
I can’t, for the love of me, figure this one out.
Hope you guys can spot what I did wrong ;).