mkhorasani / Streamlit-Authenticator

A secure authentication module to validate user credentials in a Streamlit application.
Apache License 2.0
1.38k stars 229 forks source link

Latest Update Breaks Current Applications #121

Closed brian-fx-dmz closed 5 months ago

brian-fx-dmz commented 5 months ago

Upon updating to the latest version streamlit_authenticator-0.3.1 i'm getting an error upon loading my home page - no other changes happend to the app other than reloading it on streamlit's hosting:

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit_authenticator/authenticate.py", line 238, in login
    raise DeprecationError("""Likely deprecation error, the 'form_name' parameter has been replaced
streamlit_authenticator.exceptions.DeprecationError: Likely deprecation error, the 'form_name' parameter has been replaced
                                   with the 'fields' parameter. For further information please refer to 
                                   https://github.com/mkhorasani/Streamlit-Authenticator/tree/main?tab=readme-ov-file#authenticatelogin

My login code is directly from your sample getting started:

    # Get all credentials
    with open("config.yaml") 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"],
    )

    # --- Authentication Code
    authenticator.login("Login", "main")
brian-fx-dmz commented 5 months ago

Temp work around - pin your requirements.txt to the last version...

streamlit
streamlit-authenticator==0.2.3
mkhorasani commented 5 months ago

Dear @brian-fx-dmz, please follow the instructions in the deprecation warning provided, the parameters for the widgets have changed: the form_name parameter has been replaced with the fields parameter.

brian-fx-dmz commented 5 months ago

Ugh - sorry - I got it. It wasn't clear when going to the link in the help that you removed all the arguments from the demo and are just going with defaults - I thought this was the help page for the login method.

authenticator.login()