Home / Function/ make_not_authenticated_error() — fastapi Function Reference

make_not_authenticated_error() — fastapi Function Reference

Architecture documentation for the make_not_authenticated_error() function in api_key.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  8b39fe4e_79da_b187_f689_d2d00b0a2dd6["make_not_authenticated_error()"]
  f01173ae_dbd6_605b_f92e_0035a743c419["APIKeyBase"]
  8b39fe4e_79da_b187_f689_d2d00b0a2dd6 -->|defined in| f01173ae_dbd6_605b_f92e_0035a743c419
  0a1afb2c_f4ce_fb90_4faf_3674ab253100["check_api_key()"]
  0a1afb2c_f4ce_fb90_4faf_3674ab253100 -->|calls| 8b39fe4e_79da_b187_f689_d2d00b0a2dd6
  style 8b39fe4e_79da_b187_f689_d2d00b0a2dd6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/security/api_key.py lines 29–43

    def make_not_authenticated_error(self) -> HTTPException:
        """
        The WWW-Authenticate header is not standardized for API Key authentication but
        the HTTP specification requires that an error of 401 "Unauthorized" must
        include a WWW-Authenticate header.

        Ref: https://datatracker.ietf.org/doc/html/rfc9110#name-401-unauthorized

        For this, this method sends a custom challenge `APIKey`.
        """
        return HTTPException(
            status_code=HTTP_401_UNAUTHORIZED,
            detail="Not authenticated",
            headers={"WWW-Authenticate": "APIKey"},
        )

Domain

Subdomains

Called By

Frequently Asked Questions

What does make_not_authenticated_error() do?
make_not_authenticated_error() is a function in the fastapi codebase, defined in fastapi/security/api_key.py.
Where is make_not_authenticated_error() defined?
make_not_authenticated_error() is defined in fastapi/security/api_key.py at line 29.
What calls make_not_authenticated_error()?
make_not_authenticated_error() is called by 1 function(s): check_api_key.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free