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

importing the Authenticator Package gives an error #48

Closed mthandenisithole closed 1 year ago

mthandenisithole commented 1 year ago

Hi, When I try to import streamlit_authenticator as stauth I get this error message:

Import "streamlit_authenticator" could not be resolvedPylancereportMissingImports

Please help, is the package still working?

mkhorasani commented 1 year ago

Hi @mthandenisithole, yes the package is as it was. Please try to create a new environment and reinstall streamlit_authenticator to see if the problem persists.

mthandenisithole commented 1 year ago

Thanks a lot it worked.

mthandenisithole commented 1 year ago

Can you please help with the Authenticate arguments, how should the parameter passed to credentials argument look like if for example I have 2 users?

authenticator = stauth.Authenticate(credentials= users, cookie_name= "xyz", key="abcd")

name,authentication_status, username = authenticator.login("Login","main")

Because I am getting an error that init self.credentials['usernames'] = {key.lower(): value for key, value in credentials['usernames'].items()}


TypeError: list indices must be integers or slices, not str

Also the cookie name & key can be anything right?
mkhorasani commented 1 year ago

If you are using streamlit_authenticator==0.2.1, please provide credentials and other parameters in the form of this config file.

mthandenisithole commented 1 year ago

Thanks a lot. What if I would to store the credentials in a SQL database instead of yaml file, how can go about this? So that when users Login the credentials for authentication are pulled directly from the database

mkhorasani commented 1 year ago

You're welcome. And yes there is a way to connect it to a database, for more information please refer to this tutorial.