Open sjondavey opened 9 months ago
@sjondavey Are you experiencing a similar issue where, when using OpenAI, all users can access each other's messages @mkhorasani do you have any suggestions on how to resolve this? I'm in the process of creating a chatbot and despite authentication, all users seem to be able to view each other's messages.
No unfortunately I still am not sure why this is happening.
I attempted to incorporate a UUID per session into the code, but the values are not retained once I log out and then log back in using the same user ID.
Cookies are attached to the domain. When you run in a cloud (shared environment) - all apps hosted there use the same cookies set. Does the user use several apps in the cloud? Do cookies keys overlap? If that's the case - see below.
Mohamed-512, sorry for mentioning this again on your project, but there's a https://pypi.org/project/streamlit-cookies-manager/ which is tailored for use in shared environments. It implements prefix + encryption for cookies, which allows to have a subset of cookies for your app specifically, without overlapping with other apps. Project is outdated, but works finely, just need to patch @st.cache
to @st.cache_data
.
P.S.: imo, seeing as streamlit-cookies-manager is unmaintained for ~3 years - would be cool if some1 picked up the project really.
@CHerSun Thanks for the comments. I tried using @st.cache_data, it was not working but let me check cookies manager. Any tutorial available for the same on internet? where a person has used Cookies manager with streamlit authenticator?
@sjondavey Are you experiencing a similar issue where, when using OpenAI, all users can access each other's messages @mkhorasani do you have any suggestions on how to resolve this? I'm in the process of creating a chatbot and despite authentication, all users seem to be able to view each other's messages.
Hi @hunaidkhan2000, I think this is a different issue. Have a look at this post: https://discuss.streamlit.io/t/eliminate-states-of-modules-to-avoid-the-accidental-state-sharing-across-users-sessions/27803 and see if that addresses your problem. It seems that If you keep your state (i.e. the messages for the chat) outside of the main streamlit file, then these will be accessible to other users. You may need to keep the messages only in the main streamlit file and pass them to a stateless 'chat' file.
Watching... Same issue for me.
I originally posted my issue on the Streamlit Authenticator project (here but the problem seems to be with the cookie manager. I hope you can help. Below is a basic wrapper of the OpenAI Chat API using Authentication. It works fine locally but when I deploy to the streamlit cloud, it fails after one or two calls to the API.
As noted in the comments to my post on the Streamlit Authenticator page, the issue seems to be the cookie manager because if you comment out all the cookie management code in the Authenticator, the cloud deployment seems to work. Does anyone know if there is a simple fix to this? I would like to use the Authenticator library with cookies.
I am using Python 3.10.4 and streamlit 1.28.2, streamlit-authenticator=0.2.3 and openai=1.2.4