User authentication

Hi,
I’m trying to use this solution. But the following happens when 2 users use the app at the same time. Example:
User A inputs his password (let’s say ‘pwd_A’) through ‘pwd = st.text_input(…)’ and I save it using session_state.password = pwd.
Then another user (different device) comes and input his password (let’s say pwd_B).
What happens is that for BOTH sessions, now session_state.password is pwd_B (somehow user 2 overwrote session_state.password for user 1).
Can anybody help please?

1 Like

@Juan

Hey,

were you able to resolve the problem? I’m encountering the same and it would be awesome to have a solution for that.

Best,
Michael

Could you post the code that is causing this? Functionally, the session_state should be unique to each user.

1 Like

Sorry for the super late response, I’ll create a minimal example later today.

1 Like

@mibaumgartner maybe this helps?
Two people on same session state

Hi @Juan,

yes, that solved the problem :smiley: Thanks for all your work @theimposingdwarf @Juan :slight_smile:

Best,
Michael

1 Like

Another very safe alternative is to host the streamlit app on AWS,
and use a Load Balancer authentication mechanism to protect access to the server.
This doesn’t require you to implement any login in your code, and you can even implement OAuth flows to login using your google account.
Checkout these guides;