I installed Streamlit-Authenticator and everything works as intended. However, when I reload the browser, the streamlit-option-menu on my sidebar disappears. It seems to only affect the streamlit-option-menu component, since other components do appear as expected (I will include a screen caption below to show behavior). In search of finding clues, I compared the session state before and after refreshing the browser and the only changes I saw are:
Before refresh:
“logout_key”:false
“logout”:true
“failed_login_attempts”:{
“jmm”:0
}
After refresh:
“logout”:NULL
“FormSubmitter:Register user-Register”:false
“failed_login_attempts”:{}
I have not had a reply yet, not sure if I am the only one experiencing this problem… perhaps it’s somewhat of an obscure issue, yet, I have tried pretty much everything to get this to work with no success. Any suggestions are welcomed.
Not sure whether it is a problem with streamlit or streamlit_authenticator. I updated streamlit_authenticator to the latest version and the same problem occurred after updating streamlit to version 1.32.2. The Streamlit-antd-components sidebar I used cannot be displayed. The problem was solved after downgrading streamlit to 1.32
downgrading to 1.32 solved it for me as well, however, we are losing quite a few new features that were added later, e.g. on_select is not available in 1.32
I tried the new version, it works perfectly when running alone, but Streamlit-antd-components is also very normal, when I use the streamlit_authenticator the same problem happens, when you log in/refresh the web page, the components can’t be displayed, you can manually press R to make the page display; I guess that’s the streamlit_authenticator problem, I filed an issue with the author, it seems that the author hasn’t found the reason yet, and I hope anyone else is inspired to help on github
After testing, it was found that the problem was caused by extra_streamlit_components component. If you are also using Streamlit-Authenticator and streamlit==1.37, you can use the following code to fix it
Modify Streamlit_Authenticator/models/cookie_model.py
Comment: # self.token = self.cookie_manager.get(self.cookie_name)
Modified to (streamlit==1.37)
if st.context.cookies.get(“stauth_cookie”):
self.token = st.context.cookies[“stauth_cookie”]
I tried this with streamlit==1.37.1 and streamlit-authenticator==0.3.3, and now every time I reload the page, I get logged out. Is that the expected behaviour?