After launching our MVP using Streamlit for the frontend, we wanted to start sharing some learnings with the community. Hope you find them helpful
This first repo is a simple boilerplate for authentication with Firebase’s Web API. I know there are already a few posts on (and even community libraries for) authentication in Streamlit; we put together this example with the following in mind:
Ready-to-go email and password authentication for your Streamlit app (UI, API, session state management, enough error handling, loading/success/error messages, etc.). Just configure your Firebase project and add your Web API key to .streamlit/secrets.toml.
Minimal external libraries (only requests for the API calls)
No custom components (only native Streamlit widgets)
Note: Cookies and session management (viz. session concurrency) are complex enough for their own thread and repo, so not included in this example.
Thank you so much @marduk for this! It was exactly what i was looking for and saving me definitely some time since it is my first time building a real authentication
As a sidemark: I had to delete all attributes in the form_submit_button to make it work. With the use_container_width and type attributes i always got errors…
The repo should work out of the box with the streamlit version mentioned in the requirements.txt file; if running a different version then understandable that you might need to adjust things.
Have fun building and let us know if you have questions
Persisting user session after a browser refresh would require some form of persistence on the client (typically cookies). This is not supported in this specific example, but I’m pretty sure I’ve seen several implementations (user session persistence) in the form. Have a look!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.