1

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.

user273324
  • 152
  • 3
  • 12

2 Answers2

1

For some reason it's broken again. I receive codes ending with hash (#) which gets stripped when I try to get them with $_GET['code']. Even when I manually append the hash the authentication still ends with 401, so I assume this is an internal error.

  • That happened a few times with me but all of a sudden stopped happening. Their API *service* is not the best to say the least. – user273324 Apr 15 '14 at 21:28
0

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

header("Location: " . $client->getAuthorizeUrl(array('scope' => 'non-expiring'));
user273324
  • 152
  • 3
  • 12