redirect(); } public function callback(Request $request, $driver) { $socialiteUser = Socialite::driver($driver)->user(); /** @var User $user */ $user = User::firstOrNew([ 'email' => $socialiteUser->getEmail(), ], [ 'name' => $socialiteUser->getName(), 'password' => bcrypt(Str::random()), ]); if (!$user->exists && Settings::get('disableRegistrationSso')) { return response(401); } $user->last_seen_at = Carbon::now()->format('Y-m-d H:i:s'); $user->save(); Auth::guard()->login($user, true); return redirect('/accounts?authenticated'); } }