I’m trying to get my OAuth access key using the Twitch API (I must admit it is such a long winded way compared to previously).
Here’s what I have so far and it just returns absolutely nothing - obviously my ID/Secret/Code is stored in the appropriate variables.
// Get OAuth part 2 $url = "https://id.twitch.tv/oauth2/token"; $fields = array( "client_id" => $ClientID, "client_secret" => $ClientSecret, "code" => $auth, "grant_type" => "authorization_code", "redirect_uri" => $redir ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields)); $output = curl_exec($ch); print_r($output); curl_close($ch);
Am I doing something wrong? Apparently the URL returns a 404 error so I read that you had to do a POST request using CURL. But still nothing.
Any help would be appreciated. Everything I’ve read on these forums hasn’t worked.