network)->userFromToken($request->social_token); } catch (Exception $e) { return $this->errorInternalError("Could not connect to specified social network."); } $user = $this->users->findBySocialId( $request->network, $socialUser->getId() ); if (! $user) { if (! setting('reg_enabled')) { return $this->errorForbidden("Only users who already created an account can log in."); } $user = $this->socialManager->associate($socialUser, $request->network); } if ($user->isBanned()) { return $this->errorForbidden(__("Your account is banned by administrators.")); } Auth::setUser($user); event(new LoggedIn); return $this->respondWithArray([ 'token' => $user->createToken($request->device_name)->plainTextToken ]); } }