name: doccorretor-oauth-broker-404
description: "DocCorretor: diagnose Google login 404 from Lovable OAuth broker"
triggers:
- "login fails 404"
- "oauth.lovable.app 404"
- "Failed to load resource: the server responded with a status of 404"
- "Google OAuth not working DocCorretor"
DocCorretor OAuth Broker 404 — Diagnostic
Symptoms
- - User tries to log in with Google on
documentos.rochasalesseguros.com.br/admin - - Browser console shows:
GET https://oauth.lovable.app/~oauth/initiate?...→ 404 - - App login flow breaks; user cannot authenticate
- - ✅ Supabase database permissions are correct for
tecrochasales@gmail.com - - ✅
profiles.role = 'admin'is set correctly - - ✅
user_roleshas admin entry - - ✅
role_permissionshas 11 admin entries - - ✅
has_role()function works - - ❌ The issue is OAuth broker 404 — not database
- - Supabase project:
dauftiqcvgaydddoxqhh(Active/Healthy) - - User auth ID:
107f5dde-0753-46a1-bcc5-154737d8681f - - Supabase Admin PAT:
sbp_REDACTED - - App path:
/var/www/documentos2/app/ - - Build:
source /root/.nvm/nvm.sh && cd /var/www/documentos2/app && nvm use 20 && npm run build - - Port: 3010
Root Cause
Lovable deploys apps with their own OAuth broker service (oauth.lovable.app) that proxies Google OAuth. This is NOT self-hosted — Lovable manages it. When Lovable has an outage or deprecates the broker, all Lovable-deployed apps using Google OAuth break simultaneously.
Diagnostic Steps
1. Check browser console for the specific URL causing 404 — it will be oauth.lovable.app
2. Check Lovable project status — is the project connected/active on Lovable dashboard?
3. Try direct Supabase Auth bypass — confirm Supabase Auth itself works via REST:
`bash
curl -s "https://dauftiqcvgaydddoxqhh.supabase.co/auth/v1/settings" \
-H "apikey: YOUR_ANON_KEY"
`
4. Check if email/password exists as fallback auth method
The Fix Options
Option A: Add Email/Password fallback (recommended immediate fix)
Since Lovable OAuth broker is external and not fixable from VPS, add email/password authentication via Supabase Auth.
Option B: Wait for Lovable to restore
No action possible from VPS side — Lovable manages oauth.lovable.app.
Option C: Migrate away from Lovable OAuth (long-term)
Change app to use Supabase Google OAuth directly instead of Lovable's broker. Requires Google Cloud Console credentials + Supabase Auth reconfiguration + redeploy.
What is NOT the problem
Key Files and Credentials
Gotcha: Admin access IS working in DB
Even though user can't log in, the database IS correctly configured. Once login is restored, admin sidebar will work without any further DB changes.