from fastapi import APIRouter from fastapi.security import OAuth2PasswordRequestForm, OAuth2PasswordBearer router=APIRouter(prefix="/protected") oauth2_scheme=OAuth2PasswordBearer(tokenUrl="/protected/token") @router.get("") def protected()->dict: return {"protected router": "Hello, this is a protected router"}