feat: enhance authentication flow and UI components

- Updated .env.example to include OAuth authentication details and bypass mode for development.
- Integrated AuthProvider in App component to manage authentication state.
- Added AuthCallbackPage for handling OAuth callback.
- Enhanced ExportDropdown and PublicationsTable components to display new publication indicators for authenticated users.
- Updated AppHeader to show authentication status and logout functionality.
- Improved LandingPage to support group search and simulate login in bypass mode.
- Refactored DashboardPage to conditionally handle publication exports based on user authentication status.
This commit is contained in:
Alexis
2026-04-29 12:19:47 +02:00
parent d743afd446
commit 25dfeec3f7
12 changed files with 1211 additions and 85 deletions
+22
View File
@@ -19,3 +19,25 @@ VITE_API_KEY=12ao.9-8a7b-4c&d-9e,f-?89abc
# Pon "true" SOLO si el backend no está disponible y quieres trabajar
# con los fixtures de src/services/mocks.js. En producción debe estar a "false".
VITE_USE_MOCKS=false
# ── Autenticación OAuth ORCID ────────────────────────────────────────────────
#
# El flujo real es:
# 1. Frontend abre popup → GET /api/auth/orcid/authorize
# 2. Backend redirige a sandbox.orcid.org (o pub.orcid.org en producción)
# 3. Usuario se autentica en ORCID
# 4. ORCID redirige a ORCID_REDIRECT_URI (debe apuntar a esta app)
# 5. /auth/callback extrae el code y llama al backend para obtener el JWT
#
# Para que el callback vuelva al frontend, el backend necesita:
# ORCID_REDIRECT_URI=http://localhost:5173/auth/callback
# (en backend/.env — debe coincidir con el redirect URI del app ORCID sandbox)
#
# ── Modo bypass (solo desarrollo sin credenciales OAuth configuradas) ─────────
# Cuando está a "true", el botón "Iniciar sesión" genera un token simulado
# a partir del ORCID introducido en el campo de texto, sin abrir popup ni
# contactar al backend de auth. Útil para probar la UI autenticada
# (badges "Nuevo", botón "Descargar lo nuevo") sin OAuth real.
# ADVERTENCIA: el token simulado NO es válido en el backend, por lo que
# downloaded_by_me siempre será null (sin datos reales de "novedad").
VITE_AUTH_BYPASS=false