I have encountered an issue while using this library where the synchronization between browser cookies and the Streamlit session does not align properly.
Fortunately, I managed to workaround the issue with the following simple method:
def sync_cookie_to_session():
cookie_controller.refresh() # sync
time.sleep(1) # This brief pause is absolutely necessary. Without it, there is a high probability of failing to retrieve the browser's cookies.
st.session_state['authentication_status'] = cookie_controller.get('authentication_status')
st.session_state['username'] = cookie_controller.get('username')
However, this method does not guarantee success and does not seem ideal. Do you have any good ideas for polling until the browser's cookies are successfully retrieved? If you have any suggestions, please submit a PR or provide a hint and I will try to implement it.
Hello,
I hope you're having a great day.
I have encountered an issue while using this library where the synchronization between browser cookies and the Streamlit session does not align properly.
Fortunately, I managed to workaround the issue with the following simple method:
However, this method does not guarantee success and does not seem ideal. Do you have any good ideas for polling until the browser's cookies are successfully retrieved? If you have any suggestions, please submit a PR or provide a hint and I will try to implement it.
Thank you.