Session State for Streamlit 🎈

My example application for a secure Hydralit multi-page app has a login form at the front door. You can see the login page code by expanding the “Show App Code” expander on the page. Can also see the host application code by expanding using “Show Host Code”. The entire example code is located here.

Hydralit-secure-example

3 Likes

Thanks for sharing, this is cool stuff! :smiley:
I’ve just got my login example to work except I have to press submit one more time after successful login to get rid of the login page.
Actually thought of using the time.sleep after successful login as well to show the success message before refreshing.
How did you implement the self.do_redirect() function(what does it do underneath)? I can’t see if it’s a Hydralit specific function or a Streamlit one.

It’s a Hydralit function that comes from the HydraHeadApp template class. The simple version of what it does is, set session state variable to the target app, then run st.experimental_rerun().

2 Likes

Awesome! The st.experimental_rerun() function was all I needed to get my idea working! Thanks a lot :smiley: Session state and the rerun function work great together.

Hydralit looks lit :fire: by the way, I’ll definitely play around with it.
I’m trying to find a way to call the Web Share API on button click to easily share Streamlit app data on mobile(to Telegram or Whatsapp for instance), any chance that’s already implemented in Hydralit?