@Charly_Wargnier Thank you) Unfortunately, i can’t share link, it is for internal using without external access. But i can share code.
start.py:
import streamlit as st
import streamlit_authenticator as stauth
import yaml
from yaml.loader import SafeLoader
def main():
st.set_page_config(layout="wide")
with open('config_aut.yaml', encoding="UTF-8") as file:
config = yaml.load(file, Loader=SafeLoader)
authenticator = stauth.Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['preauthorized']
)
name, authentication_status, username = authenticator.login()
#print(name, authentication_status, username)
#st.write(name, authentication_status, username)
# Initialize the authentication_status key in session state
if "authentication_status" not in st.session_state:
st.session_state["authentication_status"] = authentication_status
if st.session_state["authentication_status"]:
authenticator.logout()
st.title(f'Welcome, *{st.session_state["name"]}*')
elif st.session_state["authentication_status"] is False:
st.error('Username/password is incorrect')
elif st.session_state["authentication_status"] is None:
st.warning('Please enter your username and password')
if __name__ == "__main__":
main()
first_page.py:
import streamlit as st
st.write(st.session_state)
if st.session_state["authentication_status"]:
....
elif st.session_state["authentication_status"] is None:
st.error('You must be logged in')