{
  "id": "python/fastapi-oauth-error",
  "signature": "fastapi.exceptions.HTTPException: 401 Unauthorized - Invalid token",
  "signature_zh": "fastapi.exceptions.HTTPException: 401 未授权 - 无效令牌",
  "regex": "fastapi\\.exceptions\\.HTTPException:\\ 401\\ Unauthorized\\ \\-\\ Invalid\\ token",
  "domain": "python",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "OAuth2 令牌无效或过期，FastAPI 无法验证用户身份。",
  "root_cause_type": "generic",
  "root_cause_zh": "OAuth2 令牌无效或过期，FastAPI 无法验证用户身份。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "忽略错误，不处理令牌刷新。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "尝试在前端硬编码令牌，但会过期。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "修改密钥但忘记更新客户端。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "实现令牌刷新机制，使用 refresh_token。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "检查令牌过期时间，提前刷新。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "使用 JWT 验证库确保令牌正确。",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-28",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}