Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change in GoogleProvider between laravel/socialite:2.0.21 and laravel/socialite:2.0.22 #5

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
11 changes: 7 additions & 4 deletions src/Components/GoogleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ public function __construct($clientId, $clientSecret, $redirectUrl)
*/
protected function mapUserToObject(array $user)
{
$avatarUrl = array_get($user, 'picture');

return (new User)->setRaw($user)->map([
'id' => $user['id'],
'id' => array_get($user, 'id'),
'nickname' => array_get($user, 'nickname'),
'name' => $user['displayName'],
'email' => $user['emails'][0]['value'],
'avatar' => array_get($user, 'image')['url'],
'name' => array_get($user, 'name'),
'email' => array_get($user, 'email'),
'avatar' => $avatarUrl,
'avatar_original' => preg_replace('/\?sz=([0-9]+)/', '', $avatarUrl),
]);
}
}
3 changes: 2 additions & 1 deletion src/Services/BaseOAuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ public function createShadowOAuthUser(OAuthUserContract $OAuthUser)

if (empty($email)) {
$email = $OAuthUser->getId() . '+' . $serviceName . '@' . $serviceName . '.com';
} else {
}
else {
list($emailId, $domain) = explode('@', $email);
$email = $emailId . '+' . $serviceName . '@' . $domain;
}
Expand Down