Skip to content

Fix cookie management flow #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions streamlit_authenticator/models/cookie_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def get_cookie(self) -> Optional[Dict[str, Any]]:
If valid, returns a dictionary containing the cookie's data.
Returns None if the cookie is expired or invalid.
"""
if st.session_state['logout']:
return False
# self.token = self.cookie_manager.get(self.cookie_name)
if st.session_state.get('logout'):
return None
self.token = st.context.cookies[self.cookie_name] if self.cookie_name in \
st.context.cookies else None
if self.token is not None:
self.cookie_manager.set(self.cookie_name, self.token)
self.token = self._token_decode()
if (self.token is not False and 'username' in self.token and
self.token['exp_date'] > datetime.now().timestamp()):
Expand Down