{"record":{"id":"faa93b752c448fe0","repo":"Significant-Gravitas/AutoGPT","slug":"missing-authorization-header","errorCode":null,"errorMessage":"Missing Authorization header","messagePattern":"Missing Authorization header","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"autogpt_platform/backend/backend/api/external/middleware.py","lineNumber":40,"sourceCode":"            status_code=status.HTTP_401_UNAUTHORIZED, detail=\"Missing API key\"\n        )\n\n    api_key_obj = await validate_api_key(api_key)\n\n    if not api_key_obj:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED, detail=\"Invalid API key\"\n        )\n\n    return api_key_obj\n\n\nasync def require_access_token(\n    bearer: HTTPAuthorizationCredentials | None = Security(bearer_auth),\n) -> OAuthAccessTokenInfo:\n    \"\"\"Middleware for OAuth access token authentication only\"\"\"\n    if bearer is None:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=\"Missing Authorization header\",\n        )\n\n    try:\n        token_info, _ = await validate_access_token(bearer.credentials)\n    except (InvalidClientError, InvalidTokenError) as e:\n        raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=str(e))\n\n    return token_info\n\n\nasync def require_auth(\n    api_key: str | None = Security(api_key_header),\n    bearer: HTTPAuthorizationCredentials | None = Security(bearer_auth),\n) -> APIAuthorizationInfo:\n    \"\"\"\n    Unified authentication middleware supporting both API keys and OAuth tokens.","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/external/middleware.py#L22-L58","documentation":"Error \"Missing Authorization header\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/external/middleware.py:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include the 'Authorization' header with a valid API key or bearer token.","Ensure a proxy or client is not stripping the Authorization header."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}