Spaces:
Runtime error
Runtime error
# Copied from https://github.com/mkhorasani/Streamlit-Authenticator | |
import yaml | |
import streamlit as st | |
import streamlit_authenticator as stauth | |
with open('./auth_config.yaml') as file: | |
config = yaml.load(file, Loader=yaml.SafeLoader) | |
authenticator = stauth.Authenticate( | |
config['credentials'], | |
config['cookie']['name'], | |
config['cookie']['key'], | |
config['cookie']['expiry_days'], | |
config['preauthorized'] | |
) | |
name, authentication_status, username = authenticator.login('Login', 'main') | |
if authentication_status: | |
authenticator.logout('Logout', 'main') | |
st.write(f'Welcome *{name}*') | |
st.title('Some content') | |
elif authentication_status is False: | |
st.error('Username/password is incorrect') | |
elif authentication_status is None: | |
st.warning('Please enter your username and password') | |