Persistent logins


I have a multi-page streamlit application that i’m looking to add authentication for. I have a basic setup that takes a user/password and stores a session state variable if it is successful. How can I persist this login for a user?

Steps to reproduce

Open the app at http://localhost:8501/
Prompt for user and password shows up
Enter and submit, information appears
Navigation across pages by clicking on sidebar works fine, no login prompt

I would like to be able to stay ‘logged in’ after doing the following:

  • Refreshing the page
  • Copying the URL and pasting into another tab

Doing any of these above actions requires a log in again.

Is this possible? Any help greatly appreciated

I’ve seen people approach this by adding a component (e.g. Cookies support in Streamlit!) to save login status as a cookie, which should work for the cases you’re trying to support.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.