Skip to content

Commit c654af8

Browse files
authored
Add "email_verified" to linkedin openid (#725)
* Add email_verified to linkedin-openid * Update linkedin-openid tests
1 parent d1267db commit c654af8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Two/LinkedInOpenIdProvider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function getBasicProfile($token)
5858
'X-RestLi-Protocol-Version' => '2.0.0',
5959
],
6060
RequestOptions::QUERY => [
61-
'projection' => '(sub,email,name,given_name,family_name,picture)',
61+
'projection' => '(sub,email,email_verified,name,given_name,family_name,picture)',
6262
],
6363
]);
6464

@@ -77,6 +77,7 @@ protected function mapUserToObject(array $user)
7777
'first_name' => $user['given_name'],
7878
'last_name' => $user['family_name'],
7979
'email' => $user['email'] ?? null,
80+
'email_verified' => $user['email_verified'] ?? null,
8081
'avatar' => $user['picture'] ?? null,
8182
'avatar_original' => $user['picture'] ?? null,
8283
]);

tests/LinkedInOpenIdProviderTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function test_response()
3131
'name' => 'Nuno Maduro',
3232
'family_name' => 'Maduro',
3333
'email' => '[email protected]',
34+
'email_verified' => true,
3435
]);
3536

3637
$this->assertInstanceOf(User::class, $user);
@@ -47,6 +48,7 @@ public function test_response()
4748
'first_name' => 'Nuno',
4849
'last_name' => 'Maduro',
4950
'email' => '[email protected]',
51+
'email_verified' => true,
5052
'avatar' => 'https://media.licdn.com/dms/image/D4D03AQmZFgJNqeNNk',
5153
'avatar_original' => 'https://media.licdn.com/dms/image/D4D03AQmZFgJNqeNNk',
5254
], $user->attributes);
@@ -75,6 +77,7 @@ public function test_missing_email_and_avatar()
7577
'first_name' => 'Nuno',
7678
'last_name' => 'Maduro',
7779
'email' => null,
80+
'email_verified' => null,
7881
'avatar' => null,
7982
'avatar_original' => null,
8083
], $user->attributes);
@@ -105,7 +108,7 @@ protected function fromResponse(array $response): UserContract
105108
'X-RestLi-Protocol-Version' => '2.0.0',
106109
],
107110
RequestOptions::QUERY => [
108-
'projection' => '(sub,email,name,given_name,family_name,picture)',
111+
'projection' => '(sub,email,email_verified,name,given_name,family_name,picture)',
109112
],
110113
])->andReturns($basicProfileResponse);
111114

0 commit comments

Comments
 (0)