Streamlit Authenticator: Keeps asking for login even with cookies for 30 days?

Hello there!

I just built my first streamlit app and so far alls is fine. I deployed the app and used streamlit-authenticator to have a login form. In the yaml file, i set the cookie expiring to 30 days. Unfortunately, it keeps asking me to login everytime i refresh the page.

I was looking in the developer tools of my browser and the cookie is set correctly, but it seems like it doesnt check if its set before asking for login.

I didnt found a solution in the forum, im sorry if this question already exists.

Heres the code:

with open('.streamlit/creds.yaml') as file:
    config = yaml.load(file, Loader=SafeLoader)

authenticator = stauth.Authenticate(
    config['credentials'],
    config['cookie']['name'],
    config['cookie']['key'],
    config['cookie']['expiry_days']
)

name, authentication_status, username = authenticator.login('main')

if not authentication_status:
    st.error("Username / Passwort ist falsch!")

if authentication_status is None:
    st.warning("Bitte Benutzername / Passwort eingeben!")

if authentication_status:
   start the app...

Thank you very much in advance!

1 Like

Which version of authenticator do you use?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.