How to work sqladmin token and secret_key management?
16:53 16 Jan 2026

I set up sqladmin to fastapi project. I used aminalaee docs for set up. That works. But I do not understand some components as and . Can somebody clarify those components? What is and what is and how to manage them? Where should i get them? Where to store them if needed and so on. You can also recommend others admin panels for fastapi apps. Thanx for advance.

Here is code:

class AdminAuth(AuthenticationBackend):

    async def login(self, request: Request) -> bool:
        form = await request.form()
        username, password = form["username"], form["password"]
        session = SessionLocal()
        user = session.query(User_model).filter(User_model.username == username).first()
        if user and password == user.password:
            if user.is_admin:
                request.session.update({"token": "secret"})
                return True
        else:
            False

    async def logout(self, request: Request):
        request.session.clear()
    
    async def authenticate(self, request: Request):
        token = request.session.get("token")
        if not token:
            return False
        return True


authentication_backend = AdminAuth(secret_key='...')
authentication fastapi