Overview
During login, src/hooks/useAuth.tsx passes the raw axios error response body to UI error state. For OAuth token exchange failures, the backend returns JSON like {"error":"invalid_grant","error_description":"Token expired"}. This raw JSON string is rendered directly in the UI label, exposing technical OAuth codes and internal API error descriptions to users.
Specifications
Features:
- Auth error messages mapped to user-friendly strings in
src/utils/authErrorMessages.ts
invalid_grant maps to message about expired session
access_denied maps to credentials error message
- Raw error details logged to
appLogger.error, never shown in UI
Tasks:
- Create
src/utils/authErrorMessages.ts mapping OAuth error codes to user messages
- In
useAuth.tsx error handler, parse error.response?.data?.error and look up user message
- Fall back to generic message for unknown codes
- Log raw response to
appLogger.error
- Add unit tests for each mapped error code
Impacted Files:
src/hooks/useAuth.tsx
src/utils/authErrorMessages.ts (create)
Acceptance Criteria
- User never sees raw JSON or OAuth error codes in UI
- Common OAuth error codes mapped to friendly messages
- Unknown codes produce generic fallback message
- Full error details still appear in
appLogger.error for debugging
Overview
During login,
src/hooks/useAuth.tsxpasses the raw axios error response body to UI error state. For OAuth token exchange failures, the backend returns JSON like{"error":"invalid_grant","error_description":"Token expired"}. This raw JSON string is rendered directly in the UI label, exposing technical OAuth codes and internal API error descriptions to users.Specifications
Features:
src/utils/authErrorMessages.tsinvalid_grantmaps to message about expired sessionaccess_deniedmaps to credentials error messageappLogger.error, never shown in UITasks:
src/utils/authErrorMessages.tsmapping OAuth error codes to user messagesuseAuth.tsxerror handler, parseerror.response?.data?.errorand look up user messageappLogger.errorImpacted Files:
src/hooks/useAuth.tsxsrc/utils/authErrorMessages.ts(create)Acceptance Criteria
appLogger.errorfor debugging