Ich hoffe, jemand kann mir hier helfen:Spotify Anfrage Token gibt invalid_client
Ich habe eine Anwendung, die die Spotify API verwenden sollte. Aber nachdem ich die Autorisierung angefordert habe, bleibe ich bei der Anforderung eines Tokens. Ähnlicher Code folgt:
function post($content, $url,$clientId,$clientSecret)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Basic '.base64_encode($clientId).':'.base64_encode($clientSecret)));
return curl_exec($ch);
}
$clientId="4df42e27a76d41f9961b0952102fexxx";
$clientSecret="3088a8b6132b40dc980540880cf5bxxx";
$content=array(
'grant_type' => 'authorization_code',
'code' => $_GET["code"],
'redirect_uri' => 'http%3A%2F%2Fhome.xxx.de%2Ftoken.php',
);
echo post($content,"https://accounts.spotify.com/api/token",$clientId,$clientSecret);
Unfortunatly, ist das Ergebnis { "Fehler": "invalid_client"}, und ich habe keine Ahnung, warum ...
i von dem einen wirklich dein Geheimnis hoffe sehr viel anders ist man hier gepostet (nicht nur die 3 x ersetzt ..., es gibt nur ~ 1M Möglichkeiten zu überprüfen). hast du auch versucht 'base64_encode ($ clientId. ':'. $ clientSecret)'? – Jakumi