Spotify API授权如何运作?我已经阅读了Spotify和Guzzle文档,将其中的一个放在一起:
$client = new GuzzleHttp\Client();
$res = $client->get('https://api.spotify.com/v1/me', [
'Authorization' => ['Bearer ' . $session_owner->spotify_token],
]);
echo $res->getStatusCode(); // 200
echo $res->getBody();
但是收到此错误消息:
"错误":{ " status":401, "消息":"没有提供令牌" }
答案 0 :(得分:2)
$res = $client->post('https://api.spotify.com/v1/me', [
'headers' => [
'Authorization' => ['Bearer ' . $session_owner->spotify_token],
]
]);