FastAPI - Authentication and Security
Given this FastAPI route, what will be the response if the client sends a request without the required API key header?
from fastapi import FastAPI, Security
from fastapi.security import APIKeyHeader
app = FastAPI()
api_key_header = APIKeyHeader(name="X-API-Key")
@app.get("/data")
async def get_data(api_key: str = Security(api_key_header)):
return {"message": "Access granted", "key": api_key}