1
誰かが私を助けてくれることを願っています:Spotifyリクエストトークンがinvalid_clientを返します
私はSpotify APIを使用するアプリケーションを持っています。しかし、要求自体の後に、私はトークンを要求することに固執しています。関連のコードは次のとおりです。
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);
残念ながら、結果は{ "エラー": "invalid_client"}であると私はなぜ...
としてこれを読んでチェックするのは〜1Mの可能性しかありません)。 'base64_encode($ clientId。 ':'。$ clientSecret)'も試みましたか? – Jakumi