cookies are shared across streamlit apps. If I launch the test app 2 times in 2 tabs, I see the same cookies. Is it expected?
Hi @Mohamed ,
I have tried the sample code from Github but it shows a warning message. (Attached image)
My goal is to store login credentials(username and password) on the login page of my Streamlit app in browser cookies.
versions:
streamlit: 1.37.0
streamlit-extras: 0.4.7
Please let me know how I can remove this warning.
Thanks
Hi. This is happening because recent Streamlit versions deprecated “allow_output_mutation=True”, this parameter was used by CookieManager
The best solution would be if @Mohamed update his library.
I will try a patch in the meantime. Wish me luck.
P.D This warning doesn’t affect the CookieManager, it just shows the annoying message.
Yes, it works well with different apps.
Not sure if session manager works with two tabs neither.
I am also facing this issue.
I see a lot of people in this thread talk about storing credentials in the cookies. How do they achieve this? This would not work in my opinion because if someone logs in, everyone browsing to the app will be logged in? Or how do you make a cookie user specific in a secure manner? Or did I completely miss something?
I also wonder if the new component st.user
(see the roadmap) will solve this in a way so that also JWT token can be stored in a secure manner.
Guys its normal. Cookies are stored in the browser. So if you are using Chrome or firefox and you save cookies, it will store in the browser for that ip address/url. So storing a cookie for the domain .example.com
means if you navigate to the website using Chrome, it will always be there no matter how many tabs you open, its stored in the browser for that website. Its normal. It won’t be there if you explicitly delete it or if you go to a new browser like Firefox where you have not saved it.
I know a lot of you want to use cookies primarily for authentication, so just wanted to mention here that with 1.42, we recently launched a native authentication feature in Streamlit! This let’s you add auth via OIDC/OAuth2 (e.g. “Login with Google”) to your app. Check out the docs here: User authentication and information - Streamlit Docs
Thank you, it’s a great update. However, many of us already have our own simpler login systems (username and password). How difficult would it be to allow us to manage cookies ourselves?
We’ve been facing this issue for several years now, and it’s a highly important feature if you ask the entire community.
Unfortunately not super trivial but you can upvote the feature request here: Ability to write cookies · Issue #861 · streamlit/streamlit · GitHub
thank u for this knowledge