Add Auth to Streamlit in seconds with Replit Auth

Опубликовано: 10 Май 2025
на канале: Replit
2,631
32

📊 Secure your Streamlit dashboards with Replit Auth - Easy authentication for data scientists!

Key points:
• 00:00:20 - Introduction to Replit Auth for Streamlit applications
• 00:01:19 - Use cases for authentication in data science dashboards
• 00:02:14 - Implementing Replit Auth in Streamlit apps
• 00:02:50 - Exploring authentication headers and user data
• 00:03:46 - Customizing access control for Streamlit dashboards

🔗 Important links:
Docs: https://docs.replit.com/additional-re...
Template: https://replit.com/@matt/Streamlit-wi...

Other videos:
Replit Auth with Flask:    • Add Auth to your Flask app in Seconds...  
Replit Auth with Streamlit:    • Add Auth to Streamlit in seconds with...  
Replit Auth with React:    • Add Auth to a React app in Seconds wi...  

Code snippet:
```python
print(st.context.headers.to_dict())
if 'username' not in st.session_state:
st.session_state['username'] = st.context.headers["X-Replit-User-Name"]
allowed_user_ids = {"matt"} # Add authorized user_ids here
if st.session_state['username'] not in allowed_user_ids:
st.error(
f"Hi {st.session_state['username']}, you are not authorized to view this application."
)
st.stop()
```

Social links:
• X: https://x.com/mattppal
• Website: https://mattpalmer.io
• LinkedIn:   / matt-palmer  

#ReplitAuth #Streamlit #DataScience #DashboardSecurity

💡 How could Replit Auth improve the security and user experience of your Streamlit dashboards? Let us know in the comments!