https://github.com/devforfu/streamlit_auth
Poor man's authentication for Streamlit dashboards
https://github.com/devforfu/streamlit_auth
Last synced: about 1 year ago
JSON representation
Poor man's authentication for Streamlit dashboards
- Host: GitHub
- URL: https://github.com/devforfu/streamlit_auth
- Owner: devforfu
- Created: 2021-08-08T13:37:07.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-08T14:08:53.000Z (almost 5 years ago)
- Last Synced: 2025-02-09T01:42:39.859Z (over 1 year ago)
- Language: Python
- Size: 157 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Password-Protected Streamlit Dashboards
A small example showing how to hide a dashboard behind a trivial password-based single-user
authentication.
> Please note that it is not a "real-world", production-ready approach to
> protect access to your dashboards. It is just a very simple way to somehow
> restrict access if running on a host with public IP.
## How It Works?
This example shows a password-input widget to ask user for a password and saves it
as a part of Streamlit's session. The password is retrieved each time when the
user interacts with the dashboard. However, each time when you refresh the dashboard
or restart it, the state is lost and password should be typed again.
## Example
Start Streamlit as the following command shows.
```
DASHBOARD_PASSWORD=123 python -m streamlit run main.py
```
Open a link printed to the terminal with your browser. Then you'll see a
password-protected dashboard as the following GIF shows.

## References
1) [Discussion on Streamlit forum](https://discuss.streamlit.io/t/user-authentication/612/53)
2) [Hacking session state](https://gist.github.com/tvst/036da038ab3e999a64497f42de966a92)