-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signing in doesn't happen from the first time even if the username and the password are correct #184
Comments
Same here. The first time i put the username and password into the login widget and login, nothing happens. If I put in the same credentials a second time, everything seems to work normally... |
Sure, will see to it that this is fixed. If you can please share a sample of your source code. |
Hi @mkhorasani thanks for your quick response. You're welcome to look at my code, but I have to warn you: it's kind of a hot mess! 😁 I think the interesting bits are: the app starts with a login page which is where I create an instance of the Authenticate class and write it in the session state:
s_add_once is just a little helper function. I create the instance of Authenticate like this:
Every page starts by setting up a header with logo and title etc. In this header-setup function I get the authenticator instance from the session state and create an "unrendered" login form (if it's not the login page):
With my logger messages I can see that after the first entry of the username and password, the variables "name", "auth", "user" and "authentication_status" in the session state are "None". After the second attempt, everything gets filled in correctly. |
Exactly the same problem here. I have been using and relying on the official multipage mechanism https://docs.streamlit.io/develop/concepts/multipage-apps/page-and-navigation. Really awaiting for the upcoming new version. ❤ |
Same problem here and no ideia what to do. In my case works after the first attempt and clearing caches. |
Fix is on the way! Should be released 2-3 weeks from now. |
Is the new release coming? My mentor got kind of annoyed when logging in twice 😭🤣. Really appreciate this project ❤️. |
I had the same issue. I'm really looking forward to getting a fix in the upcoming version - for the time being, I downgraded to 0.3.1 and in my case, it works. Of course, this is only a quick fix if you are not dependent on updates/fixes of the newer versions. |
@mkhorasani My questions are:
Thank you |
Dear all I just released the latest version, please try it. I have also created a new feature where you can provide the config file path to the Authenticate class instead of providing the credentials, cookie_name, cookie key, cookie_expiry_days, and pre_authorized parameters separately. If you choose to provide the path to the config file you will not need to resave the config file after using a widget, instead Streamlit-Authenticator will automatically take care of all read/update operations - I highly recommend using this feature as it will definitely eliminate the problem of the double login. |
You're welcome.
|
@mkhorasani I am on streamlit-authenticator 0.4.1 and give the auth config path to the autheticator. The double login Error persists. Also for registration I needed 2 trys. entrypoint.py
authentication.py
app.py
|
Hi @Leon-Sander, I am unable to recreate this error. Can you please try using it without providing the path? |
Hi @mkhorasani, I had the error without providing the path, then switched to providing it, the error occurs on both ways |
Are you using Streamlit 1.37.0? That's the version I'm using. |
I was using 1.38.0, I just checked with 1.37.0, no difference. Also checked multiple browsers just in case. |
I created a test repository so everyone in this thread can check: https://github.com/Leon-Sander/Streamlit-Authenticator-Test |
@mkhorasani |
That's unusual because I am unable to recreate this issue locally. I will investigate further. |
What I noticed is that you dont even need to enter something the first time. Just clicking login with empty username and password will also just reset the UI, no warning about needing to enter username or something. |
@Leon-Sander I guess why this behavior, is because in the first Login click the authentication_status = None even if you enter the password or not. I'm trying to figure out why this specific issue doesn't occur in version 0.3.1 but occurs in newer versions. The only significant difference I've found is how the login logic is structured. In 0.3.1, it's all in one file, while newer versions split it across multiple modules. However, I doubt this is the cause of the issue. |
@unste337 |
I guess the problem is with streamlit's multipage app handling. For a different reason, I updated from streamlit-1.37.1 to streamlit-1.40.0 yesterday and now the problem is gone. Can't explain why though... |
Hi,
I am using the latest version of streamlit-authenticator (0.3.3) with the latest version of streamlit (1.37.0)
I am using the new multipage routing mechanism that streamlit recently released:
https://docs.streamlit.io/develop/concepts/multipage-apps/page-and-navigation
The issue is that I can't sign in from the first time. It doesn't seem to be doing anything when I do that. But the second time I sign in using the same username and password.
Here is a sample of the main file from which the authorization is done:
What can be the issue here? It works just fine eventually, but having to type a username and a password bothers some of my users
Thank you in advance!
The text was updated successfully, but these errors were encountered: