check_cookie
is never reach by the second user! That is what is most suprising. Otherwise I would log a “Not yet log”.
def check_cookies():
token = cookie_manager.get(cookie_name)
if token is not None:
token = _token_decode(token)
if token is not False and token['exp_date'] > datetime.now().timestamp() and 'mongo_id' in token:
client = init_connection()
st.session_state["client"] = client
user = client.usersdb.users.find_one({"_id": ObjectId(token['mongo_id'])}, {"_id": 1, "name": 1, "email": 1, "avatar": 1, "admin": 1, "oauth_id": 1, "user_settings": 1, "stripe_settings": 1, "new_user": 1})
st.session_state["current_user"] = user
st.session_state["connected"] = True
return True
return False
For more infos on the code, I released a component with it. I use a slightly different version with some function for my mongo database.