public function RestClient::initializeIdentity in Salesforce Suite 8.3
Retrieve and store the Salesforce identity given an ID url.
Parameters
string $id: Identity URL.
Throws
\Exception
Overrides RestClientInterface::initializeIdentity
Deprecated
in 8.x-4.0 and does not have an exact analog, refer to \Drupal\salesforce\SalesforceAuthProviderPluginBase::parseIdentityResponse instead.
File
- src/
Rest/ RestClient.php, line 537
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce\RestCode
public function initializeIdentity($id) {
$headers = [
'Authorization' => 'OAuth ' . $this
->getAccessToken(),
'Content-type' => 'application/json',
];
$response = $this
->httpRequest($id, NULL, $headers);
if ($response
->getStatusCode() != 200) {
throw new \Exception(t('Unable to access identity service.'), $response
->getStatusCode());
}
$data = (new RestResponse($response))->data;
$this
->setIdentity($data);
return $this;
}