{"record":{"id":"a100ef6d25e7d9db","repo":"infiniflow/ragflow","slug":"invalid-token-authentication","errorCode":null,"errorMessage":"Invalid token authentication","messagePattern":"Invalid token authentication","errorType":"exception","errorClass":"Exception","httpStatus":400,"severity":"error","filePath":"api/apps/restful_apis/agent_api.py","lineNumber":2024,"sourceCode":"                client=REDIS_CONN.REDIS,\n            )\n\n            allowed = int(res[0])\n            if allowed != 1:\n                raise Exception(\"Too many requests (rate limit exceeded)\")\n\n        except Exception as e:\n            raise Exception(f\"Rate limit error: {e}\")\n\n    def _validate_token_auth(security_cfg):\n        \"\"\"Validate header-based token authentication.\"\"\"\n        token_cfg = security_cfg.get(\"token\", {})\n        header = token_cfg.get(\"token_header\")\n        token_value = token_cfg.get(\"token_value\")\n\n        provided = request.headers.get(header)\n        if provided != token_value:\n            raise Exception(\"Invalid token authentication\")\n\n    def _validate_basic_auth(security_cfg):\n        \"\"\"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","sourceCodeStart":2006,"sourceCodeEnd":2042,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/restful_apis/agent_api.py#L2006-L2042","documentation":"Error \"Invalid token authentication\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at api/apps/restful_apis/agent_api.py:2024 when the library encounters an invalid state.","commonSituations":"The webhook request carries a missing, malformed, or outdated token; using the current configured token prevents this error.","solutions":["Provide a valid webhook token in the request.","Regenerate the token in the agent webhook settings if it was rotated."],"exampleFix":"headers = {'X-Webhook-Token': '<valid-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-15T17:31:12.345Z"}