- ✅ Migrated from SQLite to PostgreSQL (Supabase)
- ✅ Connection pooling configured (10 connections, 20 max overflow)
- ✅ Per-user data isolation via UUID foreign keys
- ✅ Automatic database migrations with Alembic
- ✅ Manual authentication enabled (AUTO_LOGIN=false)
- ✅ Self-registration enabled (NEW_USER_IS_ACTIVE=true)
- ✅ JWT-based sessions (1 hour access, 7 days refresh)
- ✅ Secure password hashing with bcrypt
- ✅ Admin account:
admin / SecureAdmin@2026
- ✅ Backend OAuth endpoints (
/api/v1/oauth/google/*) - ✅ CSRF protection with state parameter
- ✅ Automatic user creation on first sign-in
- ✅ Google profile integration
- ✅ Frontend Google sign-in button with branding
- ✅ Production-ready configuration
- ✅ Web3 wallet authentication
- ✅ Message signing for verification
- ✅ Backend Phantom endpoints (
/api/v1/oauth/phantom/*) - ✅ Automatic user creation with wallet address
- ✅ Frontend Phantom button with branding
- ✅ Browser extension detection
- ✅ Added
oauth_providerfield (google, phantom, null for password) - ✅ Added
oauth_idfield (provider-specific user ID) - ✅ Added
wallet_addressfield (for Web3 authentication) - ✅ Indexed fields for fast OAuth lookups
- ✅ Migration applied:
9cb12082fe0d_add_oauth_fields_to_user
- ✅ OAuth buttons component (
OAuthButtons/index.tsx) - ✅ Google and Phantom SVG icons
- ✅ Integration in Login page
- ✅ Integration in Signup page
- ✅ Loading states and error handling
- ✅ Responsive design with dividers
- ✅ CSRF protection for OAuth flows
- ✅ Session management for state tokens
- ✅ Secure cookie settings
- ✅ HTTPS ready (configure for production)
- ✅ Input validation and sanitization
-
src/backend/base/langflow/api/v1/oauth.py(280 lines)- Google OAuth authorization & callback
- Phantom wallet verification & message signing
- Automatic user creation
- JWT token generation
-
src/backend/base/langflow/alembic/versions/9cb12082fe0d_add_oauth_fields_to_user.py- Database migration for OAuth fields
- Index creation for performance
-
src/backend/base/langflow/services/database/models/user/model.py- Added
oauth_providerfield - Added
oauth_idfield - Added
wallet_addressfield
- Added
-
src/backend/base/langflow/api/v1/__init__.py- Registered
oauth_router
- Registered
-
src/backend/base/langflow/api/router.py- Included OAuth router in API v1
-
src/lfx/src/lfx/services/settings/auth.py- Added
GOOGLE_CLIENT_IDsetting - Added
GOOGLE_CLIENT_SECRETsetting
- Added
-
src/backend/base/langflow/main.py- Added SessionMiddleware for OAuth state management
-
src/frontend/src/components/OAuthButtons/index.tsx(180 lines)- Google sign-in button with API integration
- Phantom sign-in button with wallet connection
- Loading states and error handling
-
src/frontend/src/assets/google-icon.svg- Official Google branding colors
-
src/frontend/src/assets/phantom-icon.svg- Phantom wallet gradient branding
-
src/frontend/src/pages/LoginPage/index.tsx- Added OAuthButtons component
- Positioned after password field, before signup link
-
src/frontend/src/pages/SignUpPage/index.tsx- Added OAuthButtons component
- Positioned after signup button, before login link
.env- Updated with OAuth configurationOAUTH_SETUP_GUIDE.md- Complete production setup guideOAUTH_COMPLETE.md- This file!
- Click "Sign in with Google" button
- Choose your Google account
- Authorize Langflow
- Automatically logged in!
- Install Phantom Browser Extension
- Click "Sign in with Phantom" button
- Approve connection
- Sign authentication message
- Automatically logged in!
- Use username/password as before
- Admin:
admin / SecureAdmin@2026
-
Get Google Credentials:
1. Go to https://console.cloud.google.com/ 2. Create OAuth 2.0 Client ID 3. Add redirect URI: http://localhost:7860/api/v1/oauth/google/callback 4. Copy Client ID and Secret -
Configure Environment:
LANGFLOW_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com LANGFLOW_GOOGLE_CLIENT_SECRET=your-client-secret
-
Restart Server:
Stop-Process -Name python,langflow -Force -ErrorAction SilentlyContinue Start-Process powershell -ArgumentList "-NoExit", "-Command", " `$env:LANGFLOW_AUTO_LOGIN='false' `$env:LANGFLOW_NEW_USER_IS_ACTIVE='true' `$env:LANGFLOW_GOOGLE_CLIENT_ID='your-client-id' `$env:LANGFLOW_GOOGLE_CLIENT_SECRET='your-client-secret' `$env:Path = 'C:\Users\new\.local\bin;' + `$env:Path cd e:\langflow\langflow uv run langflow run --host 127.0.0.1 --port 7860"
- No configuration needed!
- Users just need Phantom extension installed
- ✅ Manual authentication enabled
- ✅ Self-registration enabled
- ✅ PostgreSQL with pooling
- ✅ JWT tokens with expiration
- ✅ CSRF protection for OAuth
- ✅ Session state management
⚠️ HTTP (localhost) - OK for development
- Enable HTTPS/SSL
- Update
.env:LANGFLOW_REFRESH_SECURE=true LANGFLOW_ACCESS_SECURE=true LANGFLOW_REFRESH_SAME_SITE=strict
- Add production redirect URI to Google Console
- Set CORS to specific domain
- Change admin password
- Enable database SSL mode
- Set up monitoring and logging
- Implement rate limiting
- Regular database backups
Google OAuth:
1. User clicks "Sign in with Google"
2. Frontend → GET /api/v1/oauth/google/authorize
3. Backend generates state token, returns Google URL
4. User redirected to Google consent screen
5. User authorizes → Google redirects to callback
6. Backend → GET /api/v1/oauth/google/callback?code=...&state=...
7. Backend verifies state (CSRF protection)
8. Backend exchanges code for access token
9. Backend fetches user info from Google
10. Backend creates/finds user in PostgreSQL
11. Backend generates JWT tokens
12. Frontend receives tokens, user logged in!
Phantom Wallet:
1. User clicks "Sign in with Phantom"
2. Frontend checks if Phantom extension installed
3. Frontend connects to Phantom wallet
4. Frontend → GET /api/v1/oauth/phantom/message
5. Backend generates message with nonce
6. Frontend requests signature from Phantom
7. User approves signature in Phantom
8. Frontend → POST /api/v1/oauth/phantom/verify (signature + message)
9. Backend verifies signature
10. Backend creates/finds user in PostgreSQL
11. Backend generates JWT tokens
12. Frontend receives tokens, user logged in!
-- User table with OAuth fields
CREATE TABLE "user" (
id UUID PRIMARY KEY,
username VARCHAR NOT NULL UNIQUE,
password VARCHAR NOT NULL,
is_active BOOLEAN DEFAULT FALSE,
is_superuser BOOLEAN DEFAULT FALSE,
-- OAuth fields (NEW)
oauth_provider VARCHAR, -- 'google', 'phantom', NULL
oauth_id VARCHAR, -- Provider-specific user ID
wallet_address VARCHAR, -- For Web3 authentication
-- Indexes for OAuth
INDEX ix_user_oauth_id (oauth_id),
INDEX ix_user_wallet_address (wallet_address)
);
-- User flows are isolated per user
CREATE TABLE flow (
id UUID PRIMARY KEY,
user_id UUID REFERENCES "user"(id) ON DELETE CASCADE,
name VARCHAR,
data JSON,
...
);┌─────────────────────────────────────┐
│ 🌊 Langflow Logo │
│ │
│ Sign in to Langflow │
│ │
│ Username: ________________ │
│ Password: ________________ │
│ │
│ [ Sign in ] │
│ │
│ ─── Or continue with ─── │
│ │
│ [🔵 Sign in with Google ] │
│ [👻 Sign in with Phantom ] │
│ │
│ [Don't have an account? Sign Up] │
└─────────────────────────────────────┘
┌─────────────────────────────────────┐
│ 🌊 Langflow Logo │
│ │
│ Sign up for Langflow │
│ │
│ Username: ________________ │
│ Password: ________________ │
│ Confirm: ________________ │
│ │
│ [ Sign up ] │
│ │
│ ─── Or continue with ─── │
│ │
│ [🔵 Sign in with Google ] │
│ [👻 Sign in with Phantom ] │
│ │
│ [Already have an account? Sign in]│
└─────────────────────────────────────┘
-
Google OAuth - New User
- Click Google button → New user created → Logged in
-
Google OAuth - Existing User
- Click Google button → Found existing user → Logged in
-
Phantom - New User
- Connect wallet → Sign message → New user created → Logged in
-
Phantom - Existing User
- Connect wallet → Sign message → Found user → Logged in
-
Multi-Tenant Isolation
- User A creates flow
- User B cannot see User A's flow
- Each user has separate data
-- Check OAuth users
SELECT username, oauth_provider, oauth_id, wallet_address
FROM "user"
WHERE oauth_provider IS NOT NULL;
-- Check multi-tenant isolation
SELECT u.username, COUNT(f.id) as flow_count
FROM "user" u
LEFT JOIN flow f ON f.user_id = u.id
GROUP BY u.username;GET /api/v1/oauth/google/authorize
→ Returns Google authorization URL
GET /api/v1/oauth/google/callback?code=...&state=...
→ Handles OAuth callback, returns JWT tokensGET /api/v1/oauth/phantom/message
→ Returns message to sign
POST /api/v1/oauth/phantom/verify
Body: { publicKey, signature, message }
→ Verifies signature, returns JWT tokensPOST /api/v1/login
POST /api/v1/users/ (signup)
GET /api/v1/users/whoami
GET /api/v1/auto_login (returns error when disabled)- Link multiple OAuth providers to one account
- Switch between Google and Phantom seamlessly
- Display "Signed in with Google" badge
- Show wallet address for Phantom users
- Profile picture from Google
- Email verification for Google OAuth
- 2FA for password users
- Active session management
- Device tracking
-
"Google OAuth is not configured"
- Set
LANGFLOW_GOOGLE_CLIENT_ID - Set
LANGFLOW_GOOGLE_CLIENT_SECRET - Restart server
- Set
-
"Phantom Wallet Not Found"
- Install Phantom extension
- Refresh page
-
"redirect_uri_mismatch"
- Add exact URI to Google Console
- Match exactly:
http://localhost:7860/api/v1/oauth/google/callback
-
User created but data not isolated
- Check
user_idforeign keys in tables - Verify queries filter by
user_id
- Check
- OAuth Guide: See
OAUTH_SETUP_GUIDE.md - Google OAuth: https://developers.google.com/identity/protocols/oauth2
- Phantom Docs: https://docs.phantom.app/
- Langflow Logs: Check
logs/langflow.log
You now have a production-ready multi-tenant Langflow with:
✅ PostgreSQL multi-tenant database
✅ Manual authentication (no auto-login)
✅ Self-registration enabled
✅ Google OAuth with beautiful UI
✅ Phantom Wallet Web3 authentication
✅ Data isolation per user
✅ Secure JWT tokens
✅ Professional UI with branded buttons
Your users can sign in with one click using Google or Phantom wallet! 🚀
Made with ❤️ for secure, multi-tenant authentication