Offer «Entrar con Pireon» on the panel's login page
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / test-postgres (push) Has been cancelled
Tests / mcp (push) Has been cancelled

Under the e-mail and password form, a button takes the redirect flow
(Authorization Code + PKCE), so the password is only ever typed at the
identity server. The routes for it were already there; the page had no
way to reach them.

A Pireon client allows one grant type and the panel's is a password
client, so the redirect flow can use its own: PIREON_REDIRECT_CLIENT_ID
and PIREON_REDIRECT_CLIENT_SECRET (the main client when they are empty).
The button shows up once that client is set, or with
PIREON_REDIRECT_LOGIN=true. Each session renews its token with the
client that issued it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 12:46:07 +02:00
parent 3c119d425e
commit ec4f687ca8
12 changed files with 169 additions and 14 deletions

View File

@@ -70,9 +70,20 @@ al remoto por si alguien comitea con `--no-verify`.
En `https://oauth.pireon.dev` crea un cliente OAuth con:
- **Grant types**: `password` — es el que usa el formulario de acceso del panel
Para ofrecer también **«Entrar con Pireon»** (redirección con Authorization
Code + PKCE, donde la contraseña solo se escribe en el servidor de identidad),
crea un segundo cliente, porque cada cliente admite un único grant:
- **Grant types**: `authorization_code`
- **Redirect URI**: `https://tu-dominio/auth/callback` (en local,
`http://localhost:8000/auth/callback`), solo si quieres conservar el flujo de
redirección, que sigue disponible aunque el panel ya no lo use
`http://localhost:8000/auth/callback`)
y pon sus credenciales en `PIREON_REDIRECT_CLIENT_ID` y
`PIREON_REDIRECT_CLIENT_SECRET`. El botón aparece bajo el formulario en cuanto
están; `PIREON_REDIRECT_LOGIN` lo fuerza (`true`, si el cliente principal
admite los dos grants) o lo quita (`false`). Cada sesión renueva su token con el
cliente que lo emitió.
Copia las credenciales al `.env`: