New Library: streamlit-login-auth-ui, connect your streamlit application to a pre-built and secure Login/ Sign-Up page

Hi folks! :smile:
Hope everyone is doing well,
I have created a new library which enables the developers to connect their application to a secure login/ sign-up page.

You can customize specific parts of the page without any hassle!

The library grants users an option to reset their password, users can click on Forgot Password? after which an Email is triggered containing a temporary, randomly generated password.

The library also sets encrypted cookies to remember and automatically authenticate the users without password.
The users can logout using the Logout button.

The best part is, it is purely plug and play. No DB support needed.

Checkout this video which highlights all the features of the library: streamlit_login_auth_ui_features_video.mp4 - Google Drive

Link to the Github Repository: GitHub - GauriSP10/streamlit_login_auth_ui: It lets you connect your streamlit application to a pre-built and secure Login/ Sign-Up page.

Try the Login/ Sign-Up feature on a sample application deployed on Heroku:

Checkout a working Demo of the Library: streamlit_login_auth_ui_demo.mp4 - Google Drive

The UI:


pip install streamlit-login-auth-ui

How to implement the library?

To import the library, just paste this at the starting of the code:

from streamlit_login_auth_ui.widgets import __login__

All you need to do is create an object for the __login__ class and pass the following parameters:

  1. auth_token : The unique authorization token received from - #1 Transactional Email API for Developers
  2. company_name : This is the name of the person/ organization which will send the password reset email.
  3. width : Width of the animation on the login page.
  4. height : Height of the animation on the login page.
  5. logout_button_name : The logout button name.
  6. hide_menu_bool : Pass True if the streamlit menu should be hidden.
  7. hide_footer_bool : Pass True if the ‘made with streamlit’ footer should be hidden.
  8. lottie_url : The lottie animation you would like to use on the login page. Explore animations at - Featured animations from our community

Mandatory Arguments:

  • auth_token
  • company_name
  • width
  • height

Non Mandatory Arguments:

After doing that, just call the build_login_ui() function using the object you just created and store the return value in a variable.


import streamlit as st
from streamlit_login_auth_ui.widgets import __login__

__login__obj = __login__(auth_token = "courier_auth_token", 
                    company_name = "Shims",
                    width = 200, height = 250, 
                    logout_button_name = 'Logout', hide_menu_bool = False, 
                    hide_footer_bool = False, 
                    lottie_url = '')

LOGGED_IN = __login__obj.build_login_ui()

if LOGGED_IN == True:

    st.markown("Your Streamlit Application Begins here!")

That’s it! The library handles the rest.
Just make sure you call/ build your application indented under if st.session_state['LOGGED_IN'] == True:, this guarantees that your application runs only after the user is securely logged in.


Login page

The login page, authenticates the user.

Create Account page

Stores the user info in a secure way in the _secret_auth_.json file.

Forgot Password page

After user authentication (email), triggers an email to the user containing a random password.

Reset Password page

After user authentication (email and the password shared over email), resets the password and updates the same
in the _secret_auth_.json file.

Logout button

Generated in the sidebar only if the user is logged in, allows users to logout.

Cookies are automatically created and destroyed depending on the user authentication status.


Thanks for tuning in! Would love to hear your feedback!



its really interesting, but if i want my app only to several person how to disable registration?

Hey @Gengsu07, thanks for trying out the library.
Sadly, currently there is no option to enable or disable registration. But I will surely look into it. Please feel free to take a pull from GitHub and tinker with the code!

Hey @Gengsu07 I just looked into the code, this is definitely doable. I will add this feature in the next release!

1 Like

Great, Looking forward to see your next release …
thanks @Gauri_Prabhakar

Glad to help! @Gengsu07

Looks great,
It’s incompatible with newer python versions (3.10 in my case) because of streamlit-cookies-manager
Is there a way to override this?
Would love your help in the case

Hey, @alonsh thanks for trying out the library, I tried it out with Python Version - 3.10.0. And yes it certainly requires a little effort to make it work. So here is the solution:

After activating the python environment with python version >= 3.10.0, uninstall pyarrow and pandas.
And then install them again.
In short just run the following commands:
pip uninstall pyarrow
pip uninstall pandas

and then,
pip install pyarrow
pip install pandas

Let me know if this works!

All the best!

uninstalling pyarrow screwed up my whole env
it was just easier to downgrade to python 3.9 for now

@alonsh, shoot!
Glad you had the option to downgrade though.
I will try to make the library independent of the cookie support.
Thanks for brining this to notice.


Thanks! @koninhoo

Hi, my python==3.8.5. Can I use it only after upgrading to >= 3.9?

Hi @Bruce_Yin , yes you will have to upgrade to Python 3.9.12.

Hi Gauri, first of all thanks for your great job and to provide us this library. I just want to know if there is any news about the update to disable the registration as @Gengsu07 ask before ?

hi Gengsu did you found any solution for this ?

@Gauri_Prabhakar Is there a simple way to get an “Enter” Key press to trigger the buttons such as “Login”?

This was just amazing!
Very handy, thank you very much :slight_smile:
Just one question:
What if I have a sidebar with multiple pages?
edit: I used the same code in all the pages and the login comes up correctly for all of them, the only problems are:

  1. Visually having the pages still in the sidebar before the login isn’t very pleasing IMO
  2. the login prompt changes its shape with the set_page_config’s layout of the page, so some pages its “centered” others its “wide”

Hi @oussama_sassour ! I am Sorry, I got caught up with my new job. But I am working on different features and requests. I will update things here as soon as possible.

1 Like

Hey @kee, not sure if Streamlit provides that functionality. But if you use the Tab key to navigate to the button and then press enter, you can surely achieve that.