Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have an "invalid salt" print, without error (no reaction...) #103

Closed
BastienGauthier opened this issue Dec 14, 2023 · 2 comments
Closed

Comments

@BastienGauthier
Copy link

BastienGauthier commented Dec 14, 2023

Each time I try to login with streamlit-authentificator into a streamlit application deployed on a kubernetes pod, I have a "Invalid Salt" print in the terminal, without any error. The login windows does not react. I suspect an issue with the bcrypt librairy, but I can't see where : I tried downgrading to 4.0 and 3.2, no chance.

It works fine in local mode, on windows.

An code exemple :

#%%
# Import
import streamlit as st
import streamlit_authenticator as stauth

#My config variables
username='my_user'
password='my_hashed_password'
credentials = {
        "usernames":{
            username:{
                "name":'Equipe',
                "password":password
                }
        }}
# print(credentials)
expiry_days = 30 
key = 'random_signature_key'
name = 'random_cookie_name' 

authenticator = stauth.Authenticate(credentials, name, key, expiry_days)
#%%

# hide collapsed control button
hide_bar = """
           <style>
           [data-testid='collapsedControl"] {visibility:hidden;}
           </style>
           """ 
# %%
name, st.session_state['authentication_status'], username = authenticator.login('Login', 'main')
if st.session_state['authentication_status']:
    authenticator.logout('Logout', 'main')
    st.sidebar.title(f'Welcome *{name}*!')
    # Application
    st.write("## Choisissez l'application qui vous intéresse")
    st.write("Cette application vise à exploiter les données des postes sources de manière plus fine que la représentation cartographique.")
    st.info("Choisissez l'application qui vous intéresse dans la barre latérale !", icon="◀️")
elif st.session_state['authentication_status'] == False:
    st.error('Username/password is incorrect')
    st.session_state.sidebar_state = 'collapsed'
    st.markdown(hide_bar, unsafe_allow_html=True)
elif st.session_state['authentication_status'] == None:
    st.warning('Please enter your username and password')
@mkhorasani
Copy link
Owner

Hi @BastienGauthier, your password in the config file is not hashed, please use stauth.Hasher(['my_hashed_password']).generate() to hash your password. It should look something like this - $2b$12$E9/bCaN/r8sN/FV2l8NpgOgspUBAp7UAVU6BgsXJzp/pW8gQWCprC

@BastienGauthier
Copy link
Author

BastienGauthier commented Dec 15, 2023

Actually, I wrote "my_hashed_password" not to disclose any credential, but it is hashed in the real configuration file. I use the same on windows and it works : it is really a windows vs kubernetes pods issue. Using the stauth hashing instead of the previous use solved the issue though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants