{"record":{"id":"8454b5ba2ba6a16e","repo":"Significant-Gravitas/AutoGPT","slug":"missing-authentication-provide-api-key-or-access","errorCode":null,"errorMessage":"Missing authentication. Provide API key or access token.","messagePattern":"Missing authentication\\. Provide API key or access token\\.","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"autogpt_platform/backend/backend/api/external/middleware.py","lineNumber":85,"sourceCode":"    # Try API key first\n    if api_key is not None:\n        api_key_info = await validate_api_key(api_key)\n        if api_key_info:\n            return api_key_info\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED, detail=\"Invalid API key\"\n        )\n\n    # Try OAuth bearer token\n    if bearer is not None:\n        try:\n            token_info, _ = await validate_access_token(bearer.credentials)\n            return token_info\n        except (InvalidClientError, InvalidTokenError) as e:\n            raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=str(e))\n\n    # No credentials provided\n    raise HTTPException(\n        status_code=status.HTTP_401_UNAUTHORIZED,\n        detail=\"Missing authentication. Provide API key or access token.\",\n    )\n\n\ndef require_permission(*permissions: APIKeyPermission):\n    \"\"\"\n    Dependency function for checking required permissions.\n    All listed permissions must be present.\n    (works with API keys and OAuth tokens)\n    \"\"\"\n\n    async def check_permissions(\n        auth: APIAuthorizationInfo = Security(require_auth),\n    ) -> APIAuthorizationInfo:\n        missing = [p for p in permissions if p not in auth.scopes]\n        if missing:\n            raise HTTPException(","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/external/middleware.py#L67-L103","documentation":"Error \"Missing authentication. Provide API key or access token.\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/external/middleware.py:85 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide either an API key header or a Bearer access token with the request.","Sign in first so the client can attach credentials."],"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-15T22:17:37.221Z"}