{"record":{"id":"44ea67222047c753","repo":"infiniflow/ragflow","slug":"missing-bearer-token","errorCode":null,"errorMessage":"Missing Bearer token","messagePattern":"Missing Bearer token","errorType":"exception","errorClass":"Exception","httpStatus":400,"severity":"error","filePath":"api/apps/restful_apis/agent_api.py","lineNumber":2045,"sourceCode":"        \"\"\"Validate HTTP Basic Auth credentials.\"\"\"\n        auth_cfg = security_cfg.get(\"basic_auth\", {})\n        username = auth_cfg.get(\"username\")\n        password = auth_cfg.get(\"password\")\n\n        auth = request.authorization\n        if not auth or auth.username != username or auth.password != password:\n            raise Exception(\"Invalid Basic Auth credentials\")\n\n    def _validate_jwt_auth(security_cfg):\n        \"\"\"Validate JWT token in Authorization header.\"\"\"\n        jwt_cfg = security_cfg.get(\"jwt\", {})\n        secret = jwt_cfg.get(\"secret\")\n        if not secret:\n            raise Exception(\"JWT secret not configured\")\n\n        auth_header = request.headers.get(\"Authorization\", \"\")\n        if not auth_header.startswith(\"Bearer \"):\n            raise Exception(\"Missing Bearer token\")\n\n        token = auth_header[len(\"Bearer \") :].strip()\n        if not token:\n            raise Exception(\"Empty Bearer token\")\n\n        alg = (jwt_cfg.get(\"algorithm\") or \"HS256\").upper()\n\n        decode_kwargs = {\n            \"key\": secret,\n            \"algorithms\": [alg],\n        }\n        options = {}\n        if jwt_cfg.get(\"audience\"):\n            decode_kwargs[\"audience\"] = jwt_cfg[\"audience\"]\n            options[\"verify_aud\"] = True\n        else:\n            options[\"verify_aud\"] = False\n","sourceCodeStart":2027,"sourceCodeEnd":2063,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/restful_apis/agent_api.py#L2027-L2063","documentation":"Error \"Missing Bearer token\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at api/apps/restful_apis/agent_api.py:2045 when the library encounters an invalid state.","commonSituations":"The webhook request omits the Authorization header expected for Bearer auth; adding the header prevents this error.","solutions":["Include an Authorization: Bearer <token> header in the request."],"exampleFix":"headers = {'Authorization': f'Bearer {token}'}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}