Streamlit Supabase Auth Flow
Other streamlit supabase auth packages build a custom log in form in react and pass back to the streamlit app information about the user. This package uses the the IdP's implicit flow to authenticate the user, get's the token from the URL with a simple html component, and returns a user object. The client can be used to make database queries impersonating the user.
I used LLM's to create this, and although I made all the techinal decisions and used the LLM to speed things up, I might have missed something. Please raise an issue.
Installation
pip install streamlit-supabase-auth-flow
Quick Start
1. Configure Supabase
- Go to your Supabase Dashboard
- Navigate to Authentication → Providers
- Enable your OAuth provider (e.g., Google)
- Configure redirect URLs:
- Add
http://localhost:8501for local development - Add your production URL for deployment
- Add
2. Configure Google OAuth (Example)
- Go to Google Cloud Console
- Create OAuth 2.0 Client ID
- Add authorized redirect URI:
https://YOUR_PROJECT.supabase.co/auth/v1/callback - Copy Client ID and Secret to Supabase
3. Use in Your Streamlit App
import streamlit as st
from streamlit_supabase_auth_flow import SupabaseAuth
# Initialize auth
auth = SupabaseAuth(
supabase_url="https://your-project.supabase.co",
supabase_key="your-anon-key",
redirect_uri="http://localhost:8501"
)
# Check authentication status
if auth.is_authenticated():
user = auth.get_user()
st.write(f"Welcome {user.email}!")
if st.button("Logout"):
auth.logout()
else:
st.write("Please login to continue")
auth.login_button(provider="google")
Access Supabase Client
The underlying Supabase client is available for database operations:
if auth.is_authenticated():
# Access Supabase client
supabase = auth.client
# Query your database
response = supabase.table('todos').select('*').execute()
st.write(response.data)
Metadata
Release files for streamlit-supabase-auth-flow 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| streamlit_supabase_auth_flow-0.0.2.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_supabase_auth_flow-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / streamlit_supabase_auth_flow-0.0.2.tar.gz
| Download URL | streamlit_supabase_auth_flow-0.0.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a47824d11373749d805ed8f8fcdc8c8a22ba0d49e4ec28eccdfe7a35c04d6792
|
|
BLAKE2b-256 checksum How to use checksums |
787da8c92b351ef1f6ed709e4995f492a0df223bf72452af0e2669c6b57b4334
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.4
|
Release files / streamlit_supabase_auth_flow-0.0.2-py3-none-any.whl
| Download URL | streamlit_supabase_auth_flow-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64c4f4a4fcf083009de3a32d4a5f2714cc36c5673c8e7b80a335a9949592d8a5
|
|
BLAKE2b-256 checksum How to use checksums |
1a693e0c49ff32f2845cb68ac29ccff781075b5d29786697aa28fdf5b0524d11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.4
|