You are here

protected function SalesforceAuthProviderPluginBase::parseIdentityResponse in Salesforce Suite 8.3

Handle the identity response from Salesforce.

Parameters

string $responseBody: JSON identity response from Salesforce.

Return value

array The identity.

Throws

\OAuth\Common\Http\Exception\TokenResponseException

1 call to SalesforceAuthProviderPluginBase::parseIdentityResponse()
SalesforceAuthProviderPluginBase::save in src/SalesforceAuthProviderPluginBase.php
Callback for configuration form after saving config entity.

File

src/SalesforceAuthProviderPluginBase.php, line 321

Class

SalesforceAuthProviderPluginBase
Shared methods for auth providers.

Namespace

Drupal\salesforce

Code

protected function parseIdentityResponse($responseBody) {
  $data = json_decode($responseBody, TRUE);
  if (NULL === $data || !is_array($data)) {
    throw new TokenResponseException('Unable to parse response.');
  }
  elseif (isset($data['error'])) {
    throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
  }
  return $data;
}