Closed cwk0099 closed 1 year ago
Have you tried cookie_manager.get_all().get(cookie)
? If this doesn't work then you might need to refresh the CookieManager object before getting the cookie by placing this line before your get call: cookie_manager.get_all(key="A totally unique key just to trigger a refresh")
.
yes, i tried ,and cookie_manager.get_all returns {}
This might not be the case here; but I had a similar issue and it was because the cookie is HttpOnly
Hi, how did you solve the issue @saedx1. I am using streamlit authenticator for my app which uses extra-streamlit-components' cookie manager. It was working fine when the app was deployed only on http, but after got the tls certificate and deployed the server with tls encryption, the cookie manage seems to have trouble loading cookies or saving them. Can you help please?
Is there a way to set/delete cookies that are HttpOnly?
Having this issue as well, works fine when running locally, but cookies are not set when running in streamlit cloud.
I tried to use cookie_manager.get_all().get(cookie)
but this gives the following error:
There are multiple identical st.extra_streamlit_components.CookieManager.cookie_manager widgets with key='set'
Are you able to look into this @Mohamed-512 ?
Turns out that Streamlit Cloud runs in a different timezone and I was using Pythons datetime.now()
to set the cookie expiry, which the browser treats as local time, so the cookie was expiring instantly.
Had to pass my timezone info to datetime.now(tz=pytz.timezone("Country/Region"))
Luckily my app is mostly going to be used locally, otherwise I would have to create extra code to juggle the user timezone back and forth between the browser and the streamlit back end.
The cookie manager worked before I upgraded from 0.1.3 to 0.2.1. The cookies can not be held in the cookie manager now. The streamlit page keeps being refreshed until I got the None from self.token. It worked just fine using the same streamlit version 1.15.0.
The cookie manager worked before I upgraded from 0.1.3 to 0.2.1. The cookies can not be held in the cookie manager now. The streamlit page keeps being refreshed until I got the None from self.token. It worked just fine using the same streamlit version 1.15.0.
Just tried cookie_manager.get_all().get(cookie). It works.
Hi everyone, In my case, I was trying the Code snippets in the readme.txt, and the problem was that the expiry date was hard coded,
cookie_manager.set( cookie, val, expires_at=datetime.datetime(year=2022, month=2, day=2) )
So the Cookie is expired at creation time.
The new version of the package provides more control over the cookies set using CookieManager. Also it should fix pre existing bugs.