Google OAuth — Diagnóstico

1. Sistema PHP

✅ PHP 8.4.28
✅ ext curl
✅ ext pdo
✅ ext pdo_mysql
✅ ext openssl
✅ sessions
✅ file_put_contents

2. Variables de entorno

✅ GOOGLE_CLIENT_ID    = 438455853861...
✅ GOOGLE_CLIENT_SECRET = ***NDOH
✅ GOOGLE_REDIRECT_URI = https://walteraltare.com/auth/google/callback
✅ APP_URL             = https://walteraltare.com
   APP_ENV          = production
✅ APP_SECRET          = ***

3. Archivos clave

✅ app/bootstrap.php (1,010 bytes)
✅ app/Models/ComentarioModel.php (13,747 bytes)
✅ auth/google.php (1,482 bytes)
✅ auth/google/callback.php (6,845 bytes)
✅ .htaccess (1,773 bytes)
✅ storage/logs (dir, escribible)

4. Base de datos

✅ Conexión PDO OK
✅ tabla lectores
✅ tabla comentarios
✅ tabla comentario_likes
   lectores: 3 registros

5. ComentarioModel

✅ ComentarioModel cargado
✅ método upsertLector existe

6. Escritura de logs

✅ storage/logs/ es escribible
✅ oauth-test.txt (routing test)
✅ oauth-early.txt (callback ejecutó en flujo REAL)

Contenido oauth-early.txt (últimas líneas):
2026-11-15 11:08:29 EARLY state=NONE __FILE__=/home/walteral/public_html/auth/google/callback.php
2026-11-15 19:41:41 EARLY state=NONE __FILE__=/home/walteral/public_html/auth/google/callback.php
2026-11-19 13:57:54 EARLY state=NONE __FILE__=/home/walteral/public_html/auth/google/callback.php
2026-11-26 06:01:25 EARLY state=NONE __FILE__=/home/walteral/public_html/auth/google/callback.php
2026-11-29 04:01:47 EARLY state=NONE __FILE__=/home/walteral/public_html/auth/google/callback.php

7. Sesión actual

session_id: 9a8c87913d324d9dd023a724c6b40269
oauth_debug: inactivo
oauth_state: (vacío)
lector: (no logueado)

8. Últimas líneas del log

[2026-11-15 08:08:29] OAuth cb: INICIO — session_id=bd67d91741be947a55423f55f32af4e4 oauth_debug=NO oauth_state= state_GET=
[2026-11-15 08:08:29] OAuth cb: state= code=VACIO err=
[2026-11-15 08:08:29] OAuth cb FALLO: parámetros iniciales — oauthErr= code=vacío
[2026-11-15 16:41:41] OAuth cb: INICIO — session_id=de42a13323d36a22859ed3d345f9ec73 oauth_debug=NO oauth_state= state_GET=
[2026-11-15 16:41:41] OAuth cb: state= code=VACIO err=
[2026-11-15 16:41:41] OAuth cb FALLO: parámetros iniciales — oauthErr= code=vacío
[2026-11-19 10:57:54] OAuth cb: INICIO — session_id=59b802d46489a2f240bf7c03d64b8b3d oauth_debug=NO oauth_state= state_GET=
[2026-11-19 10:57:54] OAuth cb: state= code=VACIO err=
[2026-11-19 10:57:54] OAuth cb FALLO: parámetros iniciales — oauthErr= code=vacío
[2026-11-26 03:01:25] OAuth cb: INICIO — session_id=366951349c91909a6669fc48f1b4117f oauth_debug=NO oauth_state= state_GET=
[2026-11-26 03:01:25] OAuth cb: state= code=VACIO err=
[2026-11-26 03:01:25] OAuth cb FALLO: parámetros iniciales — oauthErr= code=vacío
[2026-11-29 01:01:47] OAuth cb: INICIO — session_id=5e582b4d0f2d3a489e35cecdaa1a7f45 oauth_debug=NO oauth_state= state_GET=
[2026-11-29 01:01:47] OAuth cb: state= code=VACIO err=
[2026-11-29 01:01:47] OAuth cb FALLO: parámetros iniciales — oauthErr= code=vacío

9. .htaccess en el servidor

❌ NO hay ninguna línea con 'auth', 'google' o 'callback' en el .htaccess
   → El servidor tiene el .htaccess VIEJO sin las reglas de routing OAuth.

10. Verificar callback.php en servidor

✅ versión DEBUG-3 (la última)
✅ $debugMode = true hardcodeado
✅ tiene función oauth_fail
✅ usa str_starts_with para popup

11. .htaccess en subdirectorios auth/

✅ no existe: auth/.htaccess
✅ no existe: auth/google/.htaccess

12. Test directo de routing (sin Google)

Este botón abre directamente /auth/google/callback?state=popup.ROUTING_TEST&code=fake en una nueva pestaña, sin pasar por Google. Si oauth-test.txt aparece después → el routing funciona. Si no → Apache no manda el request a callback.php.

13. Test Login Google

El modo debug está inactivo. Activar modo debug para que el callback muestre errores en pantalla.