From: Vincent Vanwaelscappel Date: Thu, 7 Oct 2021 18:30:24 +0000 (+0200) Subject: wip #4765 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=28538fcadc93c7e6d958ca5a12c68174678d9f43;p=cubist_socialite.git wip #4765 @0.5 --- diff --git a/composer.json b/composer.json index bf7de39..06061f9 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "extra": { "laravel": { "providers": [ - "Cubist\\Socialite\\CubistSocialiteServiceProvider" + "Cubist\\Socialite\\CubistSocialiteServiceProvider", + "Cubist\\Socialite\\CubistSocialiteAuthServiceProvider", ] } } diff --git a/src/CubistSocialiteAuthProvider.php b/src/CubistSocialiteAuthProvider.php new file mode 100644 index 0000000..56d51cf --- /dev/null +++ b/src/CubistSocialiteAuthProvider.php @@ -0,0 +1,31 @@ +registerPolicies(); + + Auth::viaRequest('socialitegoogle', function (Request $request) { + $socialiteUser = Socialite::driver('google')->user(); + if ($socialiteUser) { + $userClass = config('auth.providers.users.model'); + $instance = new $userClass(); + $instance->id = $socialiteUser->getId(); + $instance->email = $socialiteUser->getEmail(); + } + }); + } +} \ No newline at end of file