public function connect($email, $password)
    {
        $deferred = new Deferred();

        $this->http->submit(Endpoints::LOGIN, [
            'username' => $email,
            'password' => $password,
        ])->then(function (Response $response) use ($deferred) {
            $json = json_decode($response->getBody(), true);

            $this->userInfo = $json;
            $this->http = new Http($this->http, $json);

            $deferred->resolve($this);
        }, function ($e) use ($deferred) {
            $deferred->reject($e);
        });

        return $deferred->promise();
    }