diff --git a/src/Components/DfOAuthTwoProvider.php b/src/Components/DfOAuthTwoProvider.php index a3a49d3..cd7b3fb 100644 --- a/src/Components/DfOAuthTwoProvider.php +++ b/src/Components/DfOAuthTwoProvider.php @@ -3,7 +3,7 @@ namespace DreamFactory\Core\OAuth\Components; use Illuminate\Support\Str; -use Symfony\Component\HttpFoundation\RedirectResponse; +use Illuminate\Http\RedirectResponse; use Laravel\Socialite\Two\InvalidStateException; use SocialiteProviders\Manager\OAuth2\User; diff --git a/src/Components/GoogleProvider.php b/src/Components/GoogleProvider.php index 6a9e32d..5969e7b 100644 --- a/src/Components/GoogleProvider.php +++ b/src/Components/GoogleProvider.php @@ -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), ]); } } \ No newline at end of file