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