Skip to content

Instantly share code, notes, and snippets.

View rastr-0's full-sized avatar
🇺🇦

Roman Milko rastr-0

🇺🇦
View GitHub Profile
@rochacbruno
rochacbruno / fastapi_session.py
Last active July 17, 2024 11:48
Session based cookie auth fastapi
from fastapi import Request, Depends, HTTPException, Response
from fastapi.responses import RedirectResponse
# This must be randomly generated
RANDON_SESSION_ID = "iskksioskassyidd"
# This must be a lookup on user database
USER_CORRECT = ("admin", "admin")
# This must be Redis, Memcached, SQLite, KV, etc...