Php SoundCloudAPI 401
所以我尝试用SoundCloud API获取播放列表,但在设置访问令牌时得到了401Php SoundCloudAPI 401,php,api,soundcloud,Php,Api,Soundcloud,所以我尝试用SoundCloud API获取播放列表,但在设置访问令牌时得到了401 <?PHP require_once('Services/Soundcloud.php'); $client = new Services_Soundcloud('id', 'secret', 'uri'); if (!isset($_GET['code'])) { header("Location: " . $client->getAuthorize
<?PHP
require_once('Services/Soundcloud.php');
$client = new Services_Soundcloud('id', 'secret', 'uri');
if (!isset($_GET['code']))
{
header("Location: " . $client->getAuthorizeUrl());
}
$access_token = $client->accessToken($_GET['code']);
$client->setAccessToken($access_token);
?>
我想这可能是我重复使用访问令牌的问题(可能?)。我不确定。解决这个问题的方法是简单地在“范围”中添加“非到期”,然后使用该代码
header("Location: " . $client->getAuthorizeUrl(array('scope' => 'non-expiring'));
不知什么原因,它又坏了。我收到以散列(
#
)结尾的代码,当我尝试使用$\u get['code']
获取它们时,散列会被剥离。即使我手动附加散列,身份验证仍以401结尾,因此我假设这是一个内部错误。这在我身上发生过几次,但突然停止了。至少可以说,他们的API服务不是最好的。