driver("google")->redirect(); } public function callback(AuthFactory $auth, SocialiteManager $socialiteManager): RedirectResponse { $socialUser = $socialiteManager->driver("google")->user(); try { /** @var User $user */ $user = User::query() ->where("email", $socialUser->getEmail()) ->firstOrFail(); } catch (ModelNotFoundException) { return redirect() ->route("login") ->withErrors([ "oauth" => __("User does not exist."), ]); } $auth->guard()->login($user, true); return redirect()->route("dashboard"); } }