The error is caused by deleting a cookie (when users logged out) that was already deleted or not there anymore.
This is actually a weird bug, the steps are:
User clicks the logout button
The authenticator deletes the cookie for this particular session
The cookie manager used by authenticator raises an exception KeyError telling the authenticator that the cookie was not there anymore, there is nothing to delete.
Was there a race condition?
This is a well known issue in github repo. For now you can bypass the error message with a try/except clause and continue the app’s execution. Rest assured that cookie is already deleted.
if st.session_state["authentication_status"]:
try:
authenticator.logout(location='main')
except KeyError:
pass # ignore it
except Exception as err:
st.error(f'Unexpected exception {err}')
raise Exception(err) # but not this, let's crash the app
Thank you! Yes, it fix the behavior with error displaying.
Lets have 2 users logged in. User_1 and User_2
If you logout under User_1 and refresh the page on User_2, User_2 will be logged out as well.
How can we be sure that sessions are different for each of users?
That is expected because of same comp and browser. Although on different tabs or pages, they are using the same browser and there is only one cookie used by authenticator on that browser on that comp, so deleting the cookie would wipe out all the entries in that cookie.
However if you create a new profile window (say guest) on same comp and browser (using google chrome) logging out in one window will not affect the other user in another window. So this is truly a different browser session and cookies are not shared. The same behavior is shown by multiple google account log in.