diff --git a/README.md b/README.md index 3ab733a..2b12955 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ pip install keycloak-oauth[fastapi] ```python from fastapi import FastAPI from starlette.middleware.sessions import SessionMiddleware -from backend.settings import settings, BASE_URL # secrets +from backend.settings import settings, BASE_URL, SECRET_KEY # secrets from keycloak.oauth import KeycloakOAuth2 keycloak = KeycloakOAuth2( @@ -27,7 +27,7 @@ keycloak = KeycloakOAuth2( keycloak.setup_fastapi_routes() app = FastAPI() -app.add_middleware(SessionMiddleware, secret_key=settings.secret_key) +app.add_middleware(SessionMiddleware, secret_key=SECRET_KEY) app.include_router(keycloak.router, prefix="/auth") ``` @@ -44,6 +44,7 @@ pip install keycloak-oauth[starlette-admin] ``` ```python +from starlette.middleware.sessions import SessionMiddleware from starlette_admin.contrib.sqla import Admin from backend.settings import settings, BASE_URL # secrets from keycloak.oauth import KeycloakOAuth2 @@ -62,6 +63,7 @@ admin = Admin( title=..., base_url=BASE_URL, auth_provider=KeycloakAuthProvider(keycloak), + middlewares=[Middleware(SessionMiddleware, secret_key=SECRET_KEY)], ) ```