OAuthOAuth2ServiceSoundCloud

The Gravity Forms Salesforce Add-On OAuth OAuth2 Service SoundCloud class.

Defined (1)

The class is defined in the following location(s).

/lib/PHPoAuthLib/src/OAuth/OAuth2/Service/SoundCloud.php  
  1. class SoundCloud extends AbstractService 
  2. public function __construct( 
  3. CredentialsInterface $credentials,  
  4. ClientInterface $httpClient,  
  5. TokenStorageInterface $storage,  
  6. $scopes = array(),  
  7. UriInterface $baseApiUri = null 
  8. ) { 
  9. parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); 
  10.  
  11. if (null === $baseApiUri) { 
  12. $this->baseApiUri = new Uri('https://api.soundcloud.com/'); 
  13.  
  14. /** 
  15. * {@inheritdoc} 
  16. */ 
  17. public function getAuthorizationEndpoint() 
  18. return new Uri('https://soundcloud.com/connect'); 
  19.  
  20. /** 
  21. * {@inheritdoc} 
  22. */ 
  23. public function getAccessTokenEndpoint() 
  24. return new Uri('https://api.soundcloud.com/oauth2/token'); 
  25.  
  26. /** 
  27. * {@inheritdoc} 
  28. */ 
  29. protected function parseAccessTokenResponse($responseBody) 
  30. $data = json_decode($responseBody, true); 
  31.  
  32. if (null === $data || !is_array($data)) { 
  33. throw new TokenResponseException('Unable to parse response.'); 
  34. } elseif (isset($data['error'])) { 
  35. throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); 
  36.  
  37. $token = new StdOAuth2Token(); 
  38. $token->setAccessToken($data['access_token']); 
  39.  
  40. if (isset($data['expires_in'])) { 
  41. $token->setLifetime($data['expires_in']); 
  42. unset($data['expires_in']); 
  43.  
  44. if (isset($data['refresh_token'])) { 
  45. $token->setRefreshToken($data['refresh_token']); 
  46. unset($data['refresh_token']); 
  47.  
  48. unset($data['access_token']); 
  49.  
  50. $token->setExtraParams($data); 
  51.  
  52. return $token;