protected function Salesforce::setIdentity in Salesforce Suite 7.3
Retrieve and store the Salesforce identity given an ID url.
Parameters
string $id: Identity URL.
Throws
2 calls to Salesforce::setIdentity()
- Salesforce::refreshToken in includes/
salesforce.inc - Refresh access token based on the refresh token. Updates session variable.
- Salesforce::requestToken in includes/
salesforce.inc - OAuth step 2: Exchange an authorization code for an access token.
File
- includes/
salesforce.inc, line 367 - Objects, properties, and methods to communicate with the Salesforce REST API
Class
- Salesforce
- Ability to authorize and communicate with the Salesforce REST API.
Code
protected function setIdentity($id) {
$headers = array(
'Authorization' => 'OAuth ' . $this
->getAccessToken(),
'Content-type' => 'application/json',
);
$response = $this
->httpRequest($id, NULL, $headers);
if ($response->code != 200) {
throw new SalesforceException(t('Unable to access identity service.'), $response->code);
}
$data = drupal_json_decode($response->data);
variable_set('salesforce_identity', $data);
}