Soundcloud API 401 [英] Soundcloud API 401

查看:21
本文介绍了Soundcloud API 401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我尝试使用 SoundCloud API 获取播放列表,但在设置访问令牌时收到 401.

So I'm trying to get a playlist with SoundCloud API, but I'm getting a 401 when setting an access token.

<?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);
?>

我认为我重用访问令牌可能有问题(也许?).我不确定.

I think it may be a problem with me reusing the access token (maybe?). I'm not sure.

推荐答案

通过简单地添加带有非过期"的发布范围"然后使用该代码来解决它.

Resolved it by simply adding posting "scope" with "non-expiring" and then using that code.

header("Location: " . $client->getAuthorizeUrl(array('scope' => 'non-expiring'));

这篇关于Soundcloud API 401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆