How to Access request.session.get("xxx") in Marimo Notebook ? #3280
-
Hi Marimo Team, First of all, thank you for creating such a great product! Marimo has been incredibly useful tool. We have successfully protected our Marimo notebook using a custom AuthMiddleware in our FastAPI application. However, we are facing an issue with accessing the session data within the Marimo notebook. Here is a brief overview of our setup: Could you please provide guidance on how to access request.session.get("xx") within the Marimo notebook? Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @SimonYang-CS, it is not currently possible. But it is something we can look into adding under
|
Beta Was this translation helpful? Give feedback.
This issue has been fixed in 0.11.6.
`
class AuthMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next):
request.scope["user"] = {
"is_authenticated": True,
"username": "email",
}
`
`
@app.cell
def cell_user_group(mo):
meta = mo.app_meta().request.meta
email = meta.get("email")
groups = meta.get("groups")
meta_md = mo.md(f"meta email: {email} groups: {groups}")
meta_md
`