import streamlit as st
import streamlit_authenticator as stauth
from streamlit_authenticator.utilities.hasher import Hasher
names = [‘John Smith’,‘Rebecca Briggs’]
usernames = [‘jsmith’,‘rbriggs’]
passwords = [‘123’,‘456’]
hashed_passwords = Hasher(passwords).generate()
authenticator = stauth.authenticate(names,usernames,hashed_passwords,
‘some_cookie_name’,‘some_signature_key’,cookie_expiry_days=30)
name, authentication_status = authenticator.login(‘Login’,‘main’)
if authentication_status:
st.write(‘Welcome %s’ % (name))
st.title(‘Some content’)
elif authentication_status == False:
st.error(‘Username/password is incorrect’)
elif authentication_status == None:
st.warning(‘Please enter your username and password’)