Hello iâm a new user of streamlit and i am trying to do a login form, but i face some issues.
I tried to use the streamlit-authenticator library, i used the script bellow :
import streamlit as st
import pickle
from pathlib import Path
import streamlit_authenticator as stauth
st.set_page_config(page_title=âappâ, layout=âwideâ)
names = [âUser1 name1â, âUser2 name2â]
usernames = [âuname1â, âuname2â]
load hashed passwords
file_path = Path(file).parent / âhashed_pw.pklâ
with file_path.open(ârbâ) as file:
hashed_passwords = pickle.load(file)
authenticator = stauth.Authenticate(names, usernames, hashed_passwords,
âAppâ, âabcdefâ, cookie_expiry_days=30)
name, authentication_status, username = authenticator.login(âLoginâ, âmainâ)
if authentication_status == False:
st.error(âUsername/password is incorrectâ)
if authentication_status == None:
st.warning(âPlease enter your username and passwordâ)
if authentication_status:
âBody Appâ
Note : I stored the passwords in hashed_pw.pkl file.
When i run that code, i got this Error : streamlit.runtime.scriptrunner.script_runner.StopException File âpathâ, loginobj = login(auth_token = âcourier_auth_tokenâ.
What can i do to resolve this ?
Also, if there is another library to do this, i take it.
Thank you for you answers !
Happy streamlit ing