Significant-Gravitas/AutoGPT · error · HTTPException

Authorization header is missing

Error message

Authorization header is missing

What it means

Error "Authorization header is missing" thrown in Significant-Gravitas/AutoGPT.

Source

Thrown at autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py:54


async def get_jwt_payload(
    credentials: HTTPAuthorizationCredentials | None = Security(bearer_jwt_auth),
) -> dict[str, Any]:
    """
    Extract and validate JWT payload from HTTP Authorization header.

    This is the core authentication function that handles:
    - Reading the `Authorization` header to obtain the JWT token
    - Verifying the JWT token's signature
    - Decoding the JWT token's payload

    :param credentials: HTTP Authorization credentials from bearer token
    :return: JWT payload dictionary
    :raises HTTPException: 401 if authentication fails
    """
    if not credentials:
        raise HTTPException(status_code=401, detail="Authorization header is missing")

    try:
        payload = await parse_jwt_token_async(credentials.credentials)
        logger.debug("Token decoded successfully")
        return payload
    except ValueError as e:
        raise HTTPException(status_code=401, detail=str(e)) from e


async def parse_jwt_token_async(
    token: str, audience: str = "authenticated"
) -> dict[str, Any]:
    """Async wrapper around :func:`parse_jwt_token`.

    On a JWKS cache miss the verification does a *synchronous* HTTP fetch
    (PyJWKClient uses urllib). Awaiting that directly on the event loop stalls
    every other request on the worker until it returns, not just this one — so
    hand it to a thread. Cache hits are pure CPU and return immediately.

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Include an 'Authorization: Bearer <token>' header in the request.
  2. Ensure the client is signed in and the token is attached by the API client.

When it happens

Trigger: Thrown at autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/9c322a8632b68a08. Report an issue: GitHub.