Project structure: react frontend + flask backend
problem description: when I log in, I call session ["token"] = username, and I see the cookie written in the browser"s cookie (the key-value pair is session:asasjndjan). When I click to log out again, request.cookies.get (" session") gets the corresponding cookies,. My problem is, according to this cookies, how to get the previous session, so that I can get the username; in session again
login code:
def login():
raw_data = request.get_data()
req_objt = json.loads(raw_data)
username = req_objt.get("username")
password = req_objt.get("password")
user = User.query.filter(User.username == username, User.password == password).first()
if user:
session["token"] = username