Skip to content

Commit

Permalink
Fix Google Oauth Login
Browse files Browse the repository at this point in the history
  • Loading branch information
tomonorman committed Jun 7, 2022
1 parent bceaf71 commit f14a9af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Components/DfOAuthTwoProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
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),
]);
}
}

0 comments on commit f14a9af

Please sign in to comment.