Note that there are some explanatory texts on larger screens.

plurals
  1. PO401 during access token setup
    primarykey
    data
    text
    <p>I've been attempting to get this working for the past day or so without any luck. I've finally simplified the code down to it's bare minimum and can't seem to find a solution.</p> <p>The $callbackURL is set to the same page so it calls this page back and returns successfully after the Soundcloud confirmation step.</p> <pre><code>&lt;?php require_once ("inc/Soundcloud.php"); $client_id = 'CLIENT_ID'; $secret = 'SECRET_KEY'; $callbackURL = "CALL_BACK_URL"; if (!isset($_GET['code'])) { $client = new Services_Soundcloud($client_id, $secret, $callbackURL ); $client -&gt; setCurlOptions(array(CURLOPT_FOLLOWLOCATION =&gt; 1, CURLOPT_CAINFO =&gt; $_SERVER['DOCUMENT_ROOT'] . '\\audio\\lib\\inc\\cacert.pem')); if (!isset($accessToken)) { $authorizeUrl = $client -&gt; getAuthorizeUrl(array('scope' =&gt; 'non-expiring')); echo "&lt;a href='$authorizeUrl'&gt;Connect&lt;/a&gt;"; } } else { $client = new Services_Soundcloud($client_id, $secret, $callbackURL ); $client -&gt; setCurlOptions(array(CURLOPT_FOLLOWLOCATION =&gt; 1, CURLOPT_CAINFO =&gt; $_SERVER['DOCUMENT_ROOT'] . '\\audio\\lib\\inc\\cacert.pem')); $accessToken = $client -&gt; accessToken($_GET['code']); echo "Token: $accessToken"; $client -&gt; setAccessToken($accessToken["access_token"]); } ?&gt; </code></pre> <p>The error:</p> <pre><code>[27-Mar-2013 16:02:59 America/New_York] PHP Fatal error: Uncaught exception 'Services_Soundcloud_Invalid_Http_Response_Code_Exception' with message 'The requested URL responded with HTTP code 401.' in D:\web\audio\lib\inc\Soundcloud.php:941 Stack trace: #0 D:\web\audio\lib\inc\Soundcloud.php(817): Services_Soundcloud-&gt;_request('https://api.sou...', Array) #1 D:\web\audio\lib\inc\Soundcloud.php(332): Services_Soundcloud-&gt;_getAccessToken(Array, Array) #2 D:\web\audio\lib\auth.php(20): Services_Soundcloud-&gt;accessToken('...') #3 {main} thrown in D:\web\audio\lib\inc\Soundcloud.php on line 941 </code></pre> <p>The issue is I continually get a 401 error on the $client->accessToken($_GET['code']) step despite $_GET['code'] being set properly. If I remove the CURLOPT_CAINFO I get the "Response Code 0" issue but I've worked past that.</p> <p>Any help is greatly appreciated.</p> <p>IIS with PHP 5.4</p> <p>EDIT: The issue was resolved with an absolute path to the PEM file for CURL. It was inconsistent in our test setup as we tried to use a relative path rather than absolute. I came to the conclusion after running CURL in verbose. Additionally, Soundcloud was suffering problems which made debugging this issue difficult.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload