Ok Thanks, following your tips, now I have an URL that generate the code (token) with 2 scope
https://id.twitch.tv/oauth2/authorize?client_id=[client_id]&response_type=code&scope=channel:manage:broadcast%20channel:manage:videos&redirect_uri=http://localhost
I pass the token (code) in the curl:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.twitch.tv/helix/channels?broadcaster_id=' . $user_id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
$jsonData = array( 'title' => 'NEWS', 'broadcaster_language' => 'es');
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Client-ID: ' . $client_id,
'Authorization: Bearer ' . $token,
'Content-Type: application/json'
));
$result = curl_exec($ch);
but I have an “Unauthorized”,“status”:401,“message”:“Invalid OAuth token”
thanks for any help!
Federico