{
  "id": "python/fastapi-oauth2-token-401",
  "signature": "HTTPException 401: {\"detail\":\"Not authenticated\"}",
  "signature_zh": "HTTPException 401: {\"detail\":\"未认证\"}",
  "regex": "HTTPException\\ 401:\\ \\{\"detail\":\"Not\\ authenticated\"\\}",
  "domain": "python",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "OAuth2PasswordBearer(tokenUrl=...) receives no Authorization header, or tokenUrl path doesn't match the actual login route.",
  "root_cause_type": "generic",
  "root_cause_zh": "OAuth2PasswordBearer(tokenUrl=...) 未收到 Authorization 头，或 tokenUrl 路径与实际登录路由不匹配。",
  "versions": [
    {
      "version": "0.100+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "0.110+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Token becomes None; downstream still fails auth.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Security regression; endpoints become public.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "oauth2_scheme = OAuth2PasswordBearer(tokenUrl='/auth/token')  # must match @app.post('/auth/token')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.93,
      "how": "Client: headers={'Authorization': f'Bearer {token}'}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}