From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- .../league/oauth2-client/src/Provider/LinkedIn.php | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 vendor/league/oauth2-client/src/Provider/LinkedIn.php (limited to 'vendor/league/oauth2-client/src/Provider/LinkedIn.php') diff --git a/vendor/league/oauth2-client/src/Provider/LinkedIn.php b/vendor/league/oauth2-client/src/Provider/LinkedIn.php new file mode 100644 index 0000000..c790ddf --- /dev/null +++ b/vendor/league/oauth2-client/src/Provider/LinkedIn.php @@ -0,0 +1,76 @@ +fields); + return 'https://api.linkedin.com/v1/people/~:(' . $fields . ')?format=json'; + } + + public function userDetails($response, AccessToken $token) + { + $user = new User(); + + $email = (isset($response->emailAddress)) ? $response->emailAddress : null; + $location = (isset($response->location->name)) ? $response->location->name : null; + $description = (isset($response->headline)) ? $response->headline : null; + $pictureUrl = (isset($response->pictureUrl)) ? $response->pictureUrl : null; + $publicProfileUrl = (isset($response->publicProfileUrl)) ? $response->publicProfileUrl : null; + + $user->exchangeArray([ + 'uid' => $response->id, + 'name' => $response->firstName.' '.$response->lastName, + 'firstname' => $response->firstName, + 'lastname' => $response->lastName, + 'email' => $email, + 'location' => $location, + 'description' => $description, + 'imageurl' => $pictureUrl, + 'urls' => $publicProfileUrl, + ]); + + return $user; + } + + public function userUid($response, AccessToken $token) + { + return $response->id; + } + + public function userEmail($response, AccessToken $token) + { + return isset($response->emailAddress) && $response->emailAddress + ? $response->emailAddress + : null; + } + + public function userScreenName($response, AccessToken $token) + { + return [$response->firstName, $response->lastName]; + } +} -- cgit v1.2.3-70-g09d2