public function api($request = null, $response = null, $sendResponse = true)
    {
        $this->klein->respond('POST', '/authenticate', $this->authenticate);
        $this->klein->onHttpError($this->handleError);

        // see https://github.com/klein/klein.php/wiki/Sub-Directory-Installation
        if ($request === null)
            $request = Request::createFromGlobals();

        // Grab the server-passed "REQUEST_URI"
        $uri = $request->server()->get('REQUEST_URI');

        // Set the request URI to a modified one (without the "subdirectory") in it
        $request->server()->set('REQUEST_URI', '/' . substr($uri, strlen($this->configuration['basePath'])));

        // Pass our request to our dispatch method
        $this->klein->dispatch($request, $response, $sendResponse);
    }