Skip to main content

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

  1. Go to your Supabase Dashboard
  2. Navigate to Authentication → Providers
  3. Enable your OAuth provider (e.g., Google)
  4. Configure redirect URLs:
    • Add http://localhost:8501 for local development
    • Add your production URL for deployment

2. Configure Google OAuth (Example)

  1. Go to Google Cloud Console
  2. Create OAuth 2.0 Client ID
  3. Add authorized redirect URI: https://YOUR_PROJECT.supabase.co/auth/v1/callback
  4. 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)

Source distribution for streamlit-supabase-auth-flow 0.0.2
File Size Uploaded
streamlit_supabase_auth_flow-0.0.2.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-supabase-auth-flow 0.0.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page