Authentication boilerplate with Firebase Web API

Hi everyone,

After launching our MVP using Streamlit for the frontend, we wanted to start sharing some learnings with the community. Hope you find them helpful :slight_smile:

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.

Have a great one!


Hi @marduk,

Thanks for sharing! Have you considered using st.experimental_connection for the connection piece?


On our to-do list! Hopefully we make it on time for the Connections Hackathon :balloon:


Awesome! Yes, you still have until the 4th of August!


Unfortunately, the link to repository is no longer working.
Does anybody knows if it is closed or moved?

1 Like

Hey there @karelin ,

I cleaned my repos some weeks ago and forgot about this - it is now back online. Hope it’s useful!


Great! Thank you!

1 Like

Thanks for sharing :slight_smile:

1 Like

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 :smiley:

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…

1 Like

You’re welcome @milappert !

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 :rocket:

Made an account just to say thank you


Why it is not holding loggin after refresh?

This is a really nice and useful example :slight_smile: Well done @marduk!!

1 Like

Hi there @Techmo !

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!