public function fetchData() {
        /* If using PHP in CGI mode and non standard environment */
        if (isset($_SERVER[$this->options["environment"]])) {
            $message = "Using token from environent";
            $header = $_SERVER[$this->options["environment"]];
        } else {
            $message = "Using token from request header";
            $header = $this->app->request->headers("Authorization");
        }

        $matches = null;

        if (preg_match("/Bearer\s+(.*)$/i", $header, $matches)) {
            $this->log(LogLevel::DEBUG, $message);
            return array(self::KEY_TOKEN => $matches[1]);
        }

        /* Bearer not found, try a cookie. */
        if ($this->app->getCookie($this->options["cookie"])) {
            $this->log(LogLevel::DEBUG, "Using token from cookie");
            $token = $this->app->getCookie($this->options["cookie"]);
            return array(self::KEY_TOKEN => $token);
        }

        /* If everything fails log and return false. */
        $message = "Token not found";

        $this->error = new \SlimPower\Authentication\Error();
        $this->error->setDescription($message);

        $this->log(LogLevel::WARNING, $message);
        return false;
    }