'invalid salt' prompt with no further details
lewisridden opened this issue · comments
Lewis commented
Hi, I followed the setup procedure from the readme page to try and secure a page on my project, but I'm getting an "invalid salt" from the console and no results from the main page.
The passwords in the initial config.yaml are plaintext, how do I hash them automatically as said in the yaml? A previous comment on the topic said to use stauth.Hasher(['my_hashed_password']).generate()
but without any mention of where to use this. Should this be called with the login element?
relevant page code
import streamlit_authenticator as stauth
import streamlit as st
import yaml
from yaml.loader import SafeLoader
# page only works for logged-in users, so add login.
with open('config.yaml') as file:
config = yaml.load(file, Loader=SafeLoader)
authenticator = stauth.Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'])
authenticator.login(form_name='Modify_Streams')
if st.session_state["authentication_status"]:
authenticator.logout()
st.write(f'Welcome *{st.session_state["name"]}*')
st.title('Some content')
elif st.session_state["authentication_status"] is False:
st.error('Username/password is incorrect')
elif st.session_state["authentication_status"] is None:
st.warning('This page only works for logged-in users.')
demo config.yaml:
credentials:
usernames:
admin:
email: email@example.com
logged_in: False # Will be managed automatically
name: Admin
password: banana # Will be hashed automatically
cookie:
expiry_days: 0
key: some_signature_key # Must be string
name: streamlit_project_cookie
Lewis commented
Disregard, fixed upon updating to .3.1