EN
SOP-IT-001 · v1.0
11 Jun 2026

Setup del Auth Gate del Manual

IT · Google OAuth + restricción @brandacare.com (sin DNS migration)

Propósito

Configurar el gate de autenticación de manual.brandacare.com para que solo usuarios con cuenta Google de @brandacare.com puedan acceder. Sin costo recurrente, sin migrar DNS, sin Netlify Pro.

Tiempo: 30 min total  ·  Quién: Yami o IT (Quasar/Santi/Manuel)

Limitación importante

Este es un gate client-side. Disuade acceso casual/público pero NO es seguridad criptográfica:
  • Alguien con conocimiento técnico puede ver source con curl/wget (el HTML está hosteado público)
  • JavaScript desactivado en el browser = sin gate
  • NO contiene PHI (eso vive en Google Apps Script / Workspace — ver TRN-IT-001)
Para el manual interno (training + SOPs sin PHI) esto es suficiente. Para PHI / datos sensibles, NUNCA confiar solo en client-side auth.

Pasos

1Crear proyecto en Google Cloud Console

  1. Andá a console.cloud.google.com
  2. Click en el selector de proyectos arriba → New Project
  3. Nombre: BrandaCare Manual Auth
  4. Organization: brandacare.com (debería aparecer si tu Workspace está bien)
  5. Create

2Habilitar Google Identity Services

  1. Sidebar → APIs & ServicesEnabled APIs & services
  2. No hace falta habilitar nada extra para OAuth básico — Google Identity está por default

3Configurar OAuth consent screen

  1. Sidebar → APIs & ServicesOAuth consent screen
  2. User Type: Internal (solo usuarios de @brandacare.com)
  3. Create
  4. App information:
    • App name: BrandaCare Manual
    • User support email: hello@brandacare.com
    • App logo: subir logo BrandaCare (opcional)
  5. App domain → Application home page: https://manual.brandacare.com
  6. Authorized domains: brandacare.com
  7. Developer contact: hello@brandacare.com
  8. Save and Continue → Scopes: dejar default → Save and Continue → Summary → Back to Dashboard

4Crear Credentials (Client ID)

  1. Sidebar → APIs & ServicesCredentials
  2. Click + Create CredentialsOAuth client ID
  3. Application type: Web application
  4. Name: BrandaCare Manual Web Client
  5. Authorized JavaScript origins → + Add URI:
    https://manual.brandacare.com
  6. Authorized redirect URIs → no hace falta agregar (usamos popup mode)
  7. Create
  8. COPIAR el Client ID que te muestra (es algo tipo 123456789-abcdef.apps.googleusercontent.com)

5Pegar el Client ID en auth.js

En tu repo local del manual, abrí docs/brand/auth.js:

const CLIENT_ID = 'REPLACE_WITH_YOUR_GOOGLE_OAUTH_CLIENT_ID.apps.googleusercontent.com';

Reemplazá esa línea con tu Client ID real:

const CLIENT_ID = '123456789-abcdef.apps.googleusercontent.com';

6Inyectar el auth gate en todos los HTMLs

cd "api open dental stedi claims"
python docs/inject_auth.py

Output esperado:

🔒 Inyectando auth gate en N archivos...
  ✅ N archivos modificados (0 ya tenían auth gate)

Esto agrega <script src="brand/auth.js"> al <head> de cada HTML. Idempotente — si lo corrés 2 veces no duplica.

7Re-deploy a Netlify

Drag-and-drop la carpeta docs/ a Netlify, o si tenés CI desde Git, push y deploy automático.

8Verificar

  1. Abrí manual.brandacare.com en pestaña incógnita
  2. Debería aparecer la pantalla de login branded BrandaCare
  3. Click "Continue with Google" → loggear con cuenta @brandacare.com → debería entrar
  4. Probar con cuenta Gmail personal (NO @brandacare.com) → debería rechazar con mensaje claro

Troubleshooting

ErrorCausaFix
"Auth gate no configurado" banner naranjaEl Client ID no se reemplazó en auth.jsEditar brand/auth.js línea 15
"Error 400: redirect_uri_mismatch"El URI no está en Authorized JS originsAgregar https://manual.brandacare.com en Google Console → Credentials → tu Client ID
"This app isn't verified"OAuth consent screen User Type es ExternalCambiar a Internal en Google Console
Login funciona pero te rechaza tu @brandacare.comEl campo ALLOWED_DOMAIN está malVerificar en auth.js línea 16: debe ser 'brandacare.com' (sin @)
Cambios en HTML no aparecen tras editarCache del browserCmd+Shift+R o incógnito

Mantenimiento

CuándoQué hacer
Nuevo SOP/training agregado al manualRe-correr python docs/inject_auth.py → re-deploy
Cambio de Client IDEditar brand/auth.js → re-deploy
Sospecha de compromisoGoogle Cloud → Credentials → regenerar Client Secret (no aplica con OAuth ID, pero podés revocar tokens)
Sesiones duran muchoCambiar SESSION_HOURS en auth.js (default: 8h)

Relacionados