mkhorasani / Streamlit-Authenticator

A secure authentication module to validate user credentials in a Streamlit application.
Apache License 2.0
1.38k stars 229 forks source link

Cookie error #113

Closed pablodz closed 5 months ago

pablodz commented 5 months ago

when I press F5 on latest version and I already logged in this error appears


2024-01-24 21:28:24.423 Uncaught app exception
Traceback (most recent call last):
  File "/root/.local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
  File "/app/pages/šŸ“šVozygoLogs.py", line 577, in <module>
    authenticator.login()
  File "/root/.local/lib/python3.11/site-packages/streamlit_authenticator/authenticate.py", line 246, in login
    self._check_cookie()
  File "/root/.local/lib/python3.11/site-packages/streamlit_authenticator/authenticate.py", line 128, in _check_cookie
    st.session_state['name'] = self.credentials['usernames'][self._get_username('id', self.token['id'])]['name']
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: False
mkhorasani commented 5 months ago

Dear @pablodz, please make sure to save changes to the config file after every widget as shown below:

with open('../config.yaml', 'w') as file:
    yaml.dump(config, file, default_flow_style=False)

This is to ensure that the new 'ID' field that is being automatically generated will be saved to the config file.

mkhorasani commented 5 months ago

Dear @pablodz, I have decided to axe Streamlit-Authenticator v0.2.5 and instead replace it with v0.3.1 to resolve this issue. Please download this latest version.

pablodz commented 5 months ago

Ok, thank you