Hi,
i'm developing 2 different apps with 2 different sets of users.
App 1 works fine. App 2 shows the following error
KeyError: 'st.session_state has no key "$$GENERATED_WIDGET_ID-637ca37599f40177530b03ec7d367849-None". Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization'
With some trial and error, seems like the browser has the app 1 user list cached and apply's it to app 2, could it be?
Or is unrelated?
thanks
code to reproduce
def get_login():
filename = 'app_users_config.yaml'
with open(filename) as file:
config = yaml.load(file, Loader=SafeLoader)
authenticator = 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 is None:
st.warning('Please enter your username and password')
login = False
elif not authentication_status:
st.error('Username/password is incorrect')
login = False
elif authentication_status:
login = True
else:
raise ValueError(f"{authentication_status=}")
return login, username
def app():
st.title('test)
login, username = get_login()
if not login:
return
st.text('Running')
Hi @iuiu34, I'm not sure if this error is related, just please make sure to use different cookie names for each app to avoid their re-authentication data (stored on the browser) being read by the wrong app.
Hi, i'm developing 2 different apps with 2 different sets of users. App 1 works fine. App 2 shows the following error
With some trial and error, seems like the browser has the app 1 user list cached and apply's it to app 2, could it be? Or is unrelated? thanks
code to reproduce