mkhorasani / Streamlit-Authenticator

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

authenticator.login() is takes too much time #164

Closed drawdehe closed 1 month ago

drawdehe commented 1 month ago

Hi,

First of all, thank you for writing this code.

I have a problem though, which is that the authenticator.login() takes a bit too much time. When loading the streamlit page, it takes about 2 seconds to load the login form, which I think is a bit too slow.

Writing this code, the time between print(3) and print(4) is really long.

print(1)

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

print(2)

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

print(3)

authenticator.login()

print(4)

Hence, I would be able to speed up the authenticator.login() call. Is it possible?

Thank you!

mkhorasani commented 1 month ago

Hi @drawdehe, thank you for reaching out. This problem has been brought up before #152, therefore I am going to close this issue and request that you kindly follow the other. Please note that the time taken to login is largely due to the package attempting to retrieve the re-authentication cookie. While I have no solution yet, this is something in the backlog and I hope to address it promptly. Cheers.

drawdehe commented 1 month ago

Thank you! Following that issue instead. :)

drawdehe commented 1 month ago

One solution could be to add the option of disabling cookies maybe?

mkhorasani commented 1 month ago

One solution could be to add the option of disabling cookies maybe?

Yeap, will do!