0
Ich versuche, mein Zugriffs-Token von trakt.tv zu bekommen. ich den Autorisierungscode, und wie die Dokumentation sagt ich:Leere Antwort curl trakt api
$ch = curl_init();
$code = $_GET['code'];
$data = array(
"code"=>$code,
"client_id"=>"my client id",
"client_secret"=>"my client secret",
"redirect_uri"=>"my redirect url",
"grant_type"=>"authorization_code"
);
curl_setopt($ch,CURLOPT_URL, "https://trakt.tv/oauth/token");
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch,CURLOPT_HEADER, FALSE);
curl_setopt($ch,CURLOPT_POST, TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
curl_setopt($ch,CURLOPT_HTTPHEADER, array(
"Content-Type: application/json"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
jedoch die Antwort leer ist. Was mache ich falsch?
welchen Wert Sie in $ code buchen? –
Es ist der Code, den ich bekomme, wenn ich die Anwendung autorisiere. Grundsätzlich bekomme ich diesen Code und ich muss ihn mit dem Access Token "austauschen". http://docs.trakt.apiary.io/#reference/authentication-oauth/authorize/exchange-code-for-access_token?console=1 – Dani