Skip to content

fix(auth): prevent raw OAuth JSON errors from showing in MobileLogin#720

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
temisan0x:fix/676-oauth-error-display
Jun 28, 2026
Merged

fix(auth): prevent raw OAuth JSON errors from showing in MobileLogin#720
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
temisan0x:fix/676-oauth-error-display

Conversation

@temisan0x

@temisan0x temisan0x commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Closes #676

What changed

  • Added src/utils/authErrorMessages.ts — maps OAuth error codes like invalid_grant and access_denied to plain English messages, with a generic fallback for anything unexpected.
  • useAuth.tsx and MobileLogin.tsx now show those friendly messages in the UI instead of raw JSON.
  • Raw error details still get logged via appLogger.error so debugging isn't affected.
  • Cleaned up MobileLogin.tsx while I was in there — the react-hook-form setup was broken and not actually doing anything, replaced it with simple local state.
  • Added unit tests covering the main error paths.

Testing

  • 4 new tests, all passing.
  • Tested login failure manually on simulator — users see clean messages, raw errors stay in the logs.

Notes

  • The hook alone wasn't enough since MobileLogin was handling errors separately. Fixing both is what actually gets this in front of users.
  • Didn't touch anything outside the scope of this issue.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@temisan0x Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@temisan0x temisan0x force-pushed the fix/676-oauth-error-display branch 3 times, most recently from 4e48457 to e9f8d12 Compare June 27, 2026 22:31
Closes rinafcode#676

- Add src/utils/authErrorMessages.ts mapping OAuth error codes
  (invalid_grant, access_denied, etc.) to user-friendly messages
- useAuth.tsx login() catch block now logs the raw Axios error via
  appLogger.error for debugging, then throws a sanitized Error with
  a mapped message instead of re-throwing the raw response
- Unknown/undefined error codes fall back to a generic message
- Add unit tests covering invalid_grant, access_denied, and unknown
  code paths
@temisan0x temisan0x force-pushed the fix/676-oauth-error-display branch from 468890a to 9e413de Compare June 27, 2026 22:45
@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit 805e1d5 into rinafcode:main Jun 28, 2026
1 of 14 checks passed
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.

[Bug] OAuth error response rendered as raw JSON in UI — exposes internal API error codes to users

2 participants