]> _ Git - cubist_socialite.git/commitdiff
wip #4765
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Oct 2021 19:06:30 +0000 (21:06 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Oct 2021 19:06:30 +0000 (21:06 +0200)
src/Http/Controllers/SocialiteController.php

index 689633a1746dd1ff8ce39724eead11503dc05f52..4d572294ba8a9bb9e1a69ea72692f18f57496b3c 100644 (file)
@@ -31,7 +31,14 @@ class SocialiteController extends Controller
     {
         $provider = request()->provider;
         if (in_array($provider, $this->providers)) {
-            dd(Socialite::driver($provider)->user());
+            $socialiteUser = Socialite::driver('google')->user();
+            if ($socialiteUser) {
+                $userClass = config('auth.providers.users.model');
+                $instance = new $userClass();
+                $instance->id = $socialiteUser->getId();
+                $instance->email = $socialiteUser->getEmail();
+                Auth::login($instance);
+            }
         }
     }
 }
\ No newline at end of file