Fix API endpoint location for Nuxt server structure
All checks were successful
build-and-deploy / build (push) Successful in 53s
build-and-deploy / deploy (push) Successful in 3s

Move /api/auth/status endpoint from app/server/ to server/ directory.
Nuxt expects server API routes to be in /server/api/, not /app/server/api/.

This fixes the issue where the endpoint was returning HTML instead of JSON.
This commit is contained in:
2025-10-13 01:33:10 -06:00
parent 51767ff0d3
commit ddea20376d

View File

@@ -1,36 +0,0 @@
/**
* API endpoint para verificar el estado de autenticación en tiempo real
* Consulta los headers inyectados por Authentik Proxy Outpost
*/
export default defineEventHandler((event) => {
// Leer headers de Authentik en tiempo real
const headers = getHeaders(event)
const username = headers['x-authentik-username']
const email = headers['x-authentik-email']
const name = headers['x-authentik-name']
const groups = headers['x-authentik-groups']
const uid = headers['x-authentik-uid']
// Si no hay username, no hay sesión activa en Authentik
if (!username) {
return {
authenticated: false,
user: null,
timestamp: new Date().toISOString()
}
}
// Sesión activa
return {
authenticated: true,
user: {
username,
email,
name,
groups: groups ? groups.split('|') : [],
uid
},
timestamp: new Date().toISOString()
}
})