Skip to content

Commit

Permalink
Merge pull request #13 from wvdongen/master
Browse files Browse the repository at this point in the history
Request extra profile fields.
  • Loading branch information
YuzuruS authored Nov 20, 2017
2 parents 604edf1 + ccbc820 commit f3de75c
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions LinkedInStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ public function oauth2callback(){
$this->mapProfile($profile, 'site-standard-profile-request.url', 'info.urls.linkedin_authenticated');

$this->callback();
}
else{
} else {
$error = array(
'code' => 'access_token_error',
'message' => 'Failed when attempting to obtain access token',
Expand All @@ -117,8 +116,7 @@ public function oauth2callback(){

$this->errorCallback($error);
}
}
else{
} else {
$error = array(
'code' => 'oauth2callback_error',
'raw' => $_GET
Expand All @@ -136,7 +134,25 @@ public function oauth2callback(){
*/
private function getProfile($access_token){
if (empty($this->strategy['profile_fields'])) {
$this->strategy['profile_fields'] = array('id', 'first-name', 'last-name', 'maiden-name', 'formatted-name', 'headline', 'industry', 'summary', 'email-address', 'picture-url', 'location:(name)', 'public-profile-url', 'site-standard-profile-request');
// See https://developer.linkedin.com/docs/fields/basic-profile
$this->strategy['profile_fields'] = array(
'id',
'first-name',
'last-name',
'maiden-name',
'formatted-name',
'headline',
'industry',
'summary',
'email-address',
'positions',
'picture-url',
'picture-urls::(original)',
'location',
'api-standard-profile-request',
'public-profile-url',
'site-standard-profile-request'
);
}

if (is_array($this->strategy['profile_fields'])) {
Expand All @@ -149,8 +165,7 @@ private function getProfile($access_token){

if (!empty($userinfo)){
return $this->recursiveGetObjectVars(simplexml_load_string($userinfo));
}
else{
} else {
$error = array(
'code' => 'userinfo_error',
'message' => 'Failed when attempting to query for user information',
Expand Down

0 comments on commit f3de75c

Please sign in to comment.