public function LinkedInAuthManager::getAccessToken in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
- 8.2 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
- 8.3 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
- 8.4 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
- 8.5 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
- 8.6 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
- 8.7 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
- 8.8 modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::getAccessToken()
Reads user's access token from social network.
Parameters
string $type: Type of action. "login" or "register".
Return value
object User's access token, if it could be read from social network. Null, otherwise.
Overrides AuthManagerInterface::getAccessToken
File
- modules/
custom/ social_auth_linkedin/ src/ LinkedInAuthManager.php, line 49
Class
- LinkedInAuthManager
- Class LinkedInAuthManager.
Namespace
Drupal\social_auth_linkedinCode
public function getAccessToken($type = '') {
try {
$access_token = $this->sdk
->getAccessToken();
return $access_token;
} catch (LinkedInException $e) {
$this->loggerFactory
->get('social_auth_linkedin')
->error('Could not get LinkedIn access token. LinkedInException: @message', [
'@message' => $e
->getMessage(),
]);
return NULL;
}
if ($access_token) {
$this->sdk
->setAccessToken($access_token);
return $access_token;
}
$this->loggerFactory
->get('social_auth_linkedin')
->error('Could not get LinkedIn access token. User cancelled the dialog in Facebook or return URL was not valid.');
return NULL;
}