From fb3438a7cf94883dface74cca67613433dcd5614 Mon Sep 17 00:00:00 2001 From: moha-ep <106144010+moha-ep@users.noreply.github.com> Date: Tue, 24 Oct 2023 16:30:58 +0200 Subject: [PATCH] [5.x.x] Update LinkedInProvider.php --- src/Two/LinkedInProvider.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Two/LinkedInProvider.php b/src/Two/LinkedInProvider.php index 746c6cc8..3ac6cbad 100644 --- a/src/Two/LinkedInProvider.php +++ b/src/Two/LinkedInProvider.php @@ -55,14 +55,19 @@ protected function getUserByToken($token) * @return array */ protected function getBasicProfile($token) - { + { + $fields = ["id","firstName","lastName","profilePicture(displayImage~:playableStreams)"]; + + if(in_array('r_liteprofile', $this->getScopes())){ + array_push($fields, 'vanityName'); + } $response = $this->getHttpClient()->get('https://api.linkedin.com/v2/me', [ RequestOptions::HEADERS => [ 'Authorization' => 'Bearer '.$token, 'X-RestLi-Protocol-Version' => '2.0.0', ], RequestOptions::QUERY => [ - 'projection' => '(id,firstName,lastName,profilePicture(displayImage~:playableStreams))', + 'projection' => "(".implode(',',$fields).")", ], ]);