Skip to content
Open
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