for token :
$ch = curl_init(); $url = 'https://id.twitch.tv/oauth2/token'; $opts = [ CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => false ]; $post = [ 'client_id' => $clientID, 'client_secret' => $sclientID, 'code' => $token, 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://tworld.lescigales.org/api.php' ]; curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt_array($ch, $opts); $response = curl_exec($ch); $json_array = json_decode($response, true); curl_close($ch); $validate_token = $json_array['access_token'];