Following the information found here:
I am having some problems. I get the AUTH CODE without a problem. But then I go to post to the URL given:
https://api.twitch.tv/api/oauth2/token
This threw me a 404 so I figured the URL they meant was:
https://api.twitch.tv/kraken/oauth2/token
But following the flow is still giving me a 400 Bad Request error. Can someone help me know what I am doing wrong?
$url = 'https://api.twitch.tv/kraken/oauth2/token';
$postdata = http_build_query(
array(
'client_id' => $cid,
'client_secret' => $csec,
'grant_type' => 'authorization_code',
'redirect_uri' => $ruri,
'code' => $authCode
)
);
$opts = array('https' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$data = file_get_contents($url,false,$context);