public function parseResponse(Response $response)
    {
        $json = $response->json();

        /*
         * The returned response must not be in JSON
         * format, unless it is an error.
         */
        if (!is_null($json)) {
            if (isset($json->error)) {
                $error = $json->error;
                throw new AccessTokenException($error->type.': '.$error->message, $error->code);
            }
        }

        $token = $response->content();

        return $this->parseToken($token);
    }