Basically I want to get the user profile link from Linkedin. I use Laravel Socialite with Socialite Providers to get the information from Linkedin.
When the user is redirected back to my site with success I've debugged the information:
User {#285 ▼
+token: "XXX"
+id: "XXX"
+nickname: null
+name: "XXX"
+email: "XXX"
+avatar: "XXX"
+"user": array:4 [▶]
}
So i wanted to extend this information with "public-profile-url", this is a Basic Profile Field from Linkedin.
I tried to do something like this in the "myproject/vendor/socialiteproviders/linkedin/src/Provider.php":
/**
* {@inheritdoc}
*/
protected function mapUserToObject(array $user)
{
return (new User())->setRaw($user)->map([
'id' => $user['id'], 'nickname' => null,
'name' => $user['formattedName'], 'email' => $user['emailAddress'],
'avatar' => array_get($user, 'pictureUrl'),
'link' => array_get($user, 'publicProfileUrl'),
]);
}
But then link will be "null".
Does somebody know how to solve this problem?