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

Hey @Liscivia , Thank You so much for the appreciation. I agree with you. Could you please share screenshots as well? So, that it is easier for everyone to understand and contribute? Thank You so much.

1 Like


As you can see I’ve got two diffeent pages with two different layouts set in the configurations of the page.
The only difference between the ‘Net Liquidity’ and ‘Home’ page is that the first one is set to wide, the other one to centered, the login prompt shows up differently in the two pages!

Thank you :slight_smile:

1 Like

Another doubt that I have is in regards of the _secret_auth_.json file where the credentials are stored, I guess that one should be hidded when the app gets deployed, isn’t it?
I’ve placed it into my .gitignore file but now the app doesn’t read the credentials, is there a way to reference it with st.secrets to be able to deploy safely?

I fixed this by implementing this:

if LOGGED_IN != True:
    with open('style1 or style 2.css') as f:
        st.markdown(f'<style>{}</style>', unsafe_allow_html=True)


.css-1bzkvni {
    display: none;

style2.css :

.css-18e3th9 {
    max-width: 46em !important;
    padding-left: 1em !important;
    padding-right: 1em !important 
.css-1bzkvni {
    display: none;

On centered layout I used style 1, on wide I used style 2.


how to disable registered user after some days of condition??

@Gauri_Prabhakar I’m sorry, is it possible to update the version of the repo on Pypi?
Just to include the Get_username function that I’d find very convenient?
Thank you

I have a PR that includes this feature. See also the, sample lines are commented out.

I am not entirely sure about only to several person.

If you mean to bypass the login username and password, I have this change to just disable the widgets.

The user can just press the Login button to enter.


import streamlit as st
from streamlit_login_auth_ui.widgets import __login__

# When deployed in streamlit cloud or using secrets.toml locally.
# users_auth_file = st.secrets['secrets_users_auth_file']
# auth_token = st.secrets['secrets_courier_auth_token']

users_auth_file = '_secret_auth_.json'
auth_token = 'courier_auth_token'  # password reset is not supported

__login__obj = __login__(

is_logged_in = __login__obj.build_login_ui()

if is_logged_in:
    st.markdown("Your Streamlit Application Begins here!")
    username = __login__obj.get_username()

See is_disable_login=True.

hello, I want to ask you,
in my app, I want to know the username using the get_username() but it return

AttributeError: ‘login’ object has no attribute ‘get_username’

How to overcome it>?

1 Like

The package at pypi is not updated yet. So the get_username() is not supported in pip install streamlit-login-auth-ui.

Here is one way to show the username. This is based on the updated repo.

Install normally.

pip install streamlit-login-auth-ui

and then see the following code on # Get the user name. comment.

import streamlit as st
from streamlit_login_auth_ui.widgets import __login__

if 'login' not in st.session_state:
    st.session_state.login = False

__login__obj = __login__(auth_token="courier_auth_token",
                    width=200, height=250,
                    logout_button_name='Logout', hide_menu_bool=False,

st.session_state.login = __login__obj.build_login_ui()

if st.session_state.login:
    st.markdown("Welcome to Main page!")

    # Get the user name.
    fetched_cookies = __login__obj.cookies
    if '__streamlit_login_signup_ui_username__' in fetched_cookies.keys():
        username = fetched_cookies['__streamlit_login_signup_ui_username__']
1 Like

thank you I recently try by implementing the code inside the method

1 Like

could this library be integrated with firebase auth? I mean, getting an authorization token.

1 Like

I’m using this plugin within a Heroku streamlit app. Where should I stored the _secret_auth_.json file? Should it really just be stored on the memory of the Heroku app? Is this secure? Is it better to maintain these secrets in a separate server, such as on AWS or GCS? If so, do you have any suggestions or links for how to do this?

Thank you for the easy and great plugin!

1 Like

I have a pull request of this repository. The secret_auth.json file can be saved in deta.

I have not tried it yet with GCS but I think this is possible.

The repo owner has not replied yet. I might create this June, a new package based on this repo with some improvements and features if the owner will not comment on my pull request.

1 Like

Great. Thanks for the effort and link! I’ll check it out. This actually matches our use case better too – allowing user login but not open registration. While merging clearly seems desirable, if the original author will not merge the PR, please let us know if you make a separate repo.

1 Like

fail to use this package switch to st_pages

if LOGGED_IN == True:


the is created by st_pages.

when it run,error is show,
he page that you have requested does not seem to exist. Running the app’s main page

  1. how can i remove this error;
  2. how add the logout button on .
1 Like

how do you it.

1 Like

Hi thanks a lot for this amazing component. Is it possible to integrate this within a database ?

1 Like

Hi, Good job done.
A continuous message is displayed on the main page can you check it?

More information in our docs.
2024-01-16 13:17:16.903 st.cache is deprecated. Please use one of Streamlit’s new caching commands,
st.cache_data or st.cache_resource. Based on this function’s return value
of type bytes, we recommend using st.cache_data.

More information in our docs.

1 Like

Heyy @Gauri_Prabhakar

while using the forgot password functionality, I’m getting Error like below
CourierAPIException: <Response [401]>

How to solve it ??

1 Like