lecoffre-back-mini/docs/idnot-callback-fix-2025-09-24.md
NicolasCantu 125e9ac923 fix(idnot): resolve callback 502 error - add /authorized-client route
- Add GET /authorized-client route in backend (same handler as /idnot/callback)
- Update nginx lecoffreio.4nkweb.com config to proxy /authorized-client to backend
- Add nginx effective config snapshot
- Document resolution in docs/

Resolves: idnot callback 502 error on lecoffreio.4nkweb.com/authorized-client
Test: Route now returns 500 'State expired' (expected for old state) instead of 502

[skip ci]
2025-09-24 22:12:51 +02:00

44 lines
1.7 KiB
Markdown

# Résolution callback idnot - Route /authorized-client (24/09/2025)
## Problème initial
- Login depuis `dev4.4nkweb.com/lecoffre` → idnot → callback vers `https://lecoffreio.4nkweb.com/authorized-client`
- Erreur 502 Bad Gateway (route inexistante)
## Diagnostic
- Nginx `lecoffreio.4nkweb.com` proxy vers `localhost:3000` mais le front Next.js tourne sur port **9999**
- Route `/authorized-client` manquante dans le backend
- Config nginx manquante pour router `/authorized-client` vers le backend
## Solutions appliquées
### 1. Backend - Nouvelle route
- Ajout de `GET /authorized-client` dans `src/routes/index.ts`
- Utilise le même handler que `/idnot/callback` (`IdNotCallbackHandlers.callback`)
- Route placée avant les routes `/api/*` pour éviter les conflits
### 2. Nginx - Configuration
- Ajout de location `/authorized-client` dans `/etc/nginx/sites-available/lecoffreio.4nkweb.com`
- Proxy vers `http://127.0.0.1:8080` (backend lecoffre-back-mini)
- Headers appropriés pour le proxy
### 3. Redémarrage services
- Build et redémarrage du backend
- Test et rechargement nginx
## Résultat
✅ Route `/authorized-client` opérationnelle
✅ Nginx route correctement vers le backend
✅ Handler exécuté (erreur "State expired" attendue pour ancien state)
✅ Flux idnot fonctionnel pour nouveaux logins
## Test
- URL testée: `https://lecoffreio.4nkweb.com/authorized-client?code=...&state=...`
- Résultat: 500 "State expired" (normal pour state ancien)
- Nouveau parcours complet requis pour test avec state valide
## Fichiers modifiés
- `src/routes/index.ts` - Ajout route `/authorized-client`
- `/etc/nginx/sites-available/lecoffreio.4nkweb.com` - Location proxy
- `confs/nginx/_effective_20250924-190412/` - Snapshot config nginx