Skip to content

fix(auth): show credential error instead of session expired on failed login - #22

Merged
gnacho merged 1 commit into
mainfrom
fix/helios-login-error
Aug 9, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/helios-login-error

Conversation

@gnacho

@gnacho gnacho commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Closes #14.

A failed login showed "Session expired" instead of the real validation
error. The global 401 handler treated every 401 as an expired session and
discarded the response body before the error message could surface, also
firing the unauthorized event.

  • api-client.ts: exclude /api/auth/login from the global 401 handler
    so the real error flows through.
  • Login.tsx: map a 401 to the localized login.error message.

Verified: tsc 0 err, lint 0 err, server 46/46, build OK, and against the
production backend the login shows "Usuario o contraseña incorrectos"
(not "sesión expirada") with no spurious unauthorized event. The built
chunk (index-CykTVXSD.js) is already deployed and matches.

… login

The global 401 handler in apiFetch discarded the response body and threw
'Sesión expirada' for every 401, including a failed login attempt, so
users saw a misleading session-expired message instead of a credential
validation error. It also dispatched the helios-unauthorized event on a
bad login.

Exclude /api/auth/login from the global handler so the real error flows
through, and map a 401 in Login to the localized login.error string.

Closes #14
@gnacho
gnacho merged commit 232a686 into main Aug 9, 2026
4 checks passed
@gnacho
gnacho deleted the fix/helios-login-error branch August 22, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login failure shows "Session expired" instead of a clear validation error

1 participant