Permalink
Browse files

Fixed formatting. Check response and assign the returned access token.

  • Loading branch information...
1 parent 2d7200a commit f272380cc9fe0fe178d86762d2535eca88b6d43f @artwist artwist committed Jul 9, 2012
Showing with 13 additions and 4 deletions.
  1. +13 −4 Services/Soundcloud.php
@@ -290,10 +290,19 @@ function credentialsFlow($username, $password)
'grant_type' => 'password'
);
- return $this->_request($this->getAccessTokenUrl(), array(
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => $postData,
- ));
+ $options = array(CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData);
+ $response = json_decode(
+ $this->_request($this->getAccessTokenUrl(), $options),
+ true
+ );
+
+ if (array_key_exists('access_token', $response)) {
+ $this->_accessToken = $response['access_token'];
+
+ return $response;
+ } else {
+ return false;
+ }
}
/**

0 comments on commit f272380

Please sign in to comment.