echo "<br>Here is your code: " . $code.'<br>';
$ch = curl_init($base_url . "oauth2/token");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$fields = array(
'client_id' => $client_id,
'client_secret' => $client_secret,
'grant_type' => 'authorization_code',
'redirect_uri' => $redirect_uri,
'code' => $code
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$data = curl_exec($ch);
$response = json_decode($data, true);
echo "<pre>".print_r($response,true)."</pre>";
echo 'Here is your token: '.$response["access_token"];
}
ok so im getting the CODE from twitch.tv but i cant get the acces token and im running this from a local machine. Some items i get NULL on the token