infiniflow/ragflow · error · Exception

Missing Bearer token

Error message

Missing Bearer token

What it means

Error "Missing Bearer token" thrown in infiniflow/ragflow.

Source

Thrown at api/apps/restful_apis/agent_api.py:2045

        """Validate HTTP Basic Auth credentials."""
        auth_cfg = security_cfg.get("basic_auth", {})
        username = auth_cfg.get("username")
        password = auth_cfg.get("password")

        auth = request.authorization
        if not auth or auth.username != username or auth.password != password:
            raise Exception("Invalid Basic Auth credentials")

    def _validate_jwt_auth(security_cfg):
        """Validate JWT token in Authorization header."""
        jwt_cfg = security_cfg.get("jwt", {})
        secret = jwt_cfg.get("secret")
        if not secret:
            raise Exception("JWT secret not configured")

        auth_header = request.headers.get("Authorization", "")
        if not auth_header.startswith("Bearer "):
            raise Exception("Missing Bearer token")

        token = auth_header[len("Bearer ") :].strip()
        if not token:
            raise Exception("Empty Bearer token")

        alg = (jwt_cfg.get("algorithm") or "HS256").upper()

        decode_kwargs = {
            "key": secret,
            "algorithms": [alg],
        }
        options = {}
        if jwt_cfg.get("audience"):
            decode_kwargs["audience"] = jwt_cfg["audience"]
            options["verify_aud"] = True
        else:
            options["verify_aud"] = False

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Include an Authorization: Bearer <token> header in the request.

Example fix

headers = {'Authorization': f'Bearer {token}'}

When it happens

Trigger: Thrown at api/apps/restful_apis/agent_api.py:2045 when the library encounters an invalid state.

Common situations: The webhook request omits the Authorization header expected for Bearer auth; adding the header prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/44ea67222047c753. Report an issue: GitHub.