Open arishokri opened 2 weeks ago
@bongton if you want to share source code please point to an existing repo on GitHub, don't share external files.
@arishokri I have the same issue, I fixed the issue by render a button Logout. See the following snippet code:
from streamlit import session_state as ss
auth = Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['pre-authorized'],
auto_hash=True
)
if ss.authentication_status:
st.subheader(f"Welcome {ss.username}! You are logged in.", divider='rainbow')
with st.sidebar:
if st.button(label="Logout", use_container_width=True,type='primary'):
ss['WhoAmI']=ss.guest
auth.logout()
ss.authentication_status=None
st.rerun()
So I'm not sure why this is happening. But with having cookies active, even after use successfully logs out, a page refresh changes the authentication status back to True effectively kicks the user back into logged in status without authentication required. This always happens with the first successful logout attempt but if the user refreshes the page, and logs out one more time the problem resolves itself. Also, changing cookies name of key temporarily resolves the problem.
Client: Chrome on Mac, Version 127.0.6533.120 (Official Build) (arm64) Server1: Nginx on Ubuntu Server2: Macbook with M3 Pro
Code related to authentication: