Set cookie and delete cookie are not sync operation.
I don't know when it finish. sometimes it success, sometimes it just fail without raising error. Very confusing.
SLEEP_TIME_FOR_COKKIE = 5
async def get_cookie_manager_instance():
cm = stx.CookieManager()
with st.spinner("Initializing..."):
time.sleep(SLEEP_TIME_FOR_COKKIE)
return cm
def main():
# Initialize cookie manager in session state
if 'cm' not in st.session_state:
st.session_state.cm = await get_cookie_manager_instance()
COOKIE_MANAGER = st.session_state.cm
COOKIE_MANAGER.set("token", "value", secure=True)
time.sleep(SLEEP_TIME_FOR_COKKIE)
# Cannot see cookie in chrome developer tool
assert COOKIE_MANAGER.get("token") != None
Set cookie and delete cookie are not sync operation.
I don't know when it finish. sometimes it success, sometimes it just fail without raising error. Very confusing.