Skip to content

Commit

Permalink
Add "email_verified" to linkedin openid (#725)
Browse files Browse the repository at this point in the history
* Add email_verified to linkedin-openid

* Update linkedin-openid tests
  • Loading branch information
aalyusuf authored Jan 15, 2025
1 parent d1267db commit c654af8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Two/LinkedInOpenIdProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected function getBasicProfile($token)
'X-RestLi-Protocol-Version' => '2.0.0',
],
RequestOptions::QUERY => [
'projection' => '(sub,email,name,given_name,family_name,picture)',
'projection' => '(sub,email,email_verified,name,given_name,family_name,picture)',
],
]);

Expand All @@ -77,6 +77,7 @@ protected function mapUserToObject(array $user)
'first_name' => $user['given_name'],
'last_name' => $user['family_name'],
'email' => $user['email'] ?? null,
'email_verified' => $user['email_verified'] ?? null,
'avatar' => $user['picture'] ?? null,
'avatar_original' => $user['picture'] ?? null,
]);
Expand Down
5 changes: 4 additions & 1 deletion tests/LinkedInOpenIdProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function test_response()
'name' => 'Nuno Maduro',
'family_name' => 'Maduro',
'email' => '[email protected]',
'email_verified' => true,
]);

$this->assertInstanceOf(User::class, $user);
Expand All @@ -47,6 +48,7 @@ public function test_response()
'first_name' => 'Nuno',
'last_name' => 'Maduro',
'email' => '[email protected]',
'email_verified' => true,
'avatar' => 'https://media.licdn.com/dms/image/D4D03AQmZFgJNqeNNk',
'avatar_original' => 'https://media.licdn.com/dms/image/D4D03AQmZFgJNqeNNk',
], $user->attributes);
Expand Down Expand Up @@ -75,6 +77,7 @@ public function test_missing_email_and_avatar()
'first_name' => 'Nuno',
'last_name' => 'Maduro',
'email' => null,
'email_verified' => null,
'avatar' => null,
'avatar_original' => null,
], $user->attributes);
Expand Down Expand Up @@ -105,7 +108,7 @@ protected function fromResponse(array $response): UserContract
'X-RestLi-Protocol-Version' => '2.0.0',
],
RequestOptions::QUERY => [
'projection' => '(sub,email,name,given_name,family_name,picture)',
'projection' => '(sub,email,email_verified,name,given_name,family_name,picture)',
],
])->andReturns($basicProfileResponse);

Expand Down

0 comments on commit c654af8

Please sign in to comment.