{"record":{"id":"cc568832a979ef6d","repo":"unclecode/crawl4ai","slug":"admin-scope-required","errorCode":null,"errorMessage":"Admin scope required","messagePattern":"Admin scope required","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"deploy/docker/auth.py","lineNumber":140,"sourceCode":"    \"\"\"Backward-compatible dependency factory.\n\n    Auth enforcement now lives in the AuthGateMiddleware (the outermost ASGI\n    layer); by the time any route dependency runs, the request was already\n    authenticated by the gate or rejected with 401. This dependency simply\n    surfaces the validated principal to handlers that declared `_td`.\n    \"\"\"\n\n    def _principal(request: Request) -> Optional[Dict]:\n        return get_principal(request)\n\n    return _principal\n\n\ndef require_admin(request: Request) -> Dict:\n    \"\"\"Dependency: require an admin-scope principal (destructive actions).\"\"\"\n    principal = get_principal(request)\n    if not principal or principal.get(\"scope\") != \"admin\":\n        raise HTTPException(status_code=403, detail=\"Admin scope required\")\n    return principal\n\n\nclass TokenRequest(BaseModel):\n    email: EmailStr\n    api_token: Optional[str] = None\n","sourceCodeStart":122,"sourceCodeEnd":147,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/deploy/docker/auth.py#L122-L147","documentation":"Error \"Admin scope required\" thrown in unclecode/crawl4ai.","triggerScenarios":"Thrown at deploy/docker/auth.py:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Authenticate with a token that has the admin scope for this endpoint.","Ask the server operator to grant admin scope to your token."],"exampleFix":"Authorization: Bearer <admin-scoped-token>","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}