get_fastapi_dependency
get_fastapi_dependency
Get a FastAPI dependency function that can be used with Depends() to protect
routes. The dependency tries each enabled auth method in order: Bearer token
and Basic Auth.
Parameters
optional
When True, unauthenticated requests pass through with
{"authenticated": False} instead of raising a 401 error.
Returns
Callable — An async function suitable for use as a FastAPI dependency.
Returns a dict with authenticated (bool) and method (str or None) keys.