Skip to content

Added a more descriptive error message for AuthorizationExceptions#886

Open
KevinvdBurg wants to merge 9 commits into
FormidableLabs:mainfrom
KevinvdBurg:more-descriptive-error-messages
Open

Added a more descriptive error message for AuthorizationExceptions#886
KevinvdBurg wants to merge 9 commits into
FormidableLabs:mainfrom
KevinvdBurg:more-descriptive-error-messages

Conversation

@KevinvdBurg
Copy link
Copy Markdown

@KevinvdBurg KevinvdBurg commented Aug 23, 2023

Description

Adds underlying native error details to authorization failures so vague messages like Network error include the lower-level cause when available.

This revives the original Android improvement, updates it for the current package layout, and extends the same behavior to iOS.

Related: #861, #745, #799.

Verification

  • Verified Android locally with the demo app by forcing the IdentityServer token endpoint to use https://expired.badssl.com.
  • Confirmed Android showed Network error - Cause: Unacceptable certificate..., proving the native cause is surfaced.
  • Built and launched the iOS demo app, then verified the same broken token endpoint flow on iOS.
Android iOS
image image

@robwalkerco
Copy link
Copy Markdown
Contributor

Thanks for your PR @KevinvdBurg

I noticed that you only modified the error description for Android. Is iOS already providing this additional error information? If not, would you be able to update your PR to keep iOS and Android aligned?

@KevinvdBurg
Copy link
Copy Markdown
Author

Hi @robwalkerco,

I'm trying to open the iOS project, but I'm getting the following error 🤔
image

But also, I'm unsure where the iOS variant handleAuthorizationException is the naming is not consistent between the platforms. If you can point me to the right function, I can add it. :)

@carbonrobot carbonrobot added the needs-triage Waiting for a member of the team to confirm label May 2, 2024
@bryceknz
Copy link
Copy Markdown
Contributor

Thanks for this contribution, @KevinvdBurg!

I was able to verify the Android behavior locally, and the added cause detail makes the error much more useful for debugging.

I’m going to continue the work from here by bringing the branch up to date with the current repo structure and extending the same underlying-error detail to iOS as well.

I'll make sure to give you git credit when I merge it!

@bryceknz bryceknz removed the needs-triage Waiting for a member of the team to confirm label May 19, 2026
@bryceknz bryceknz requested a review from Copilot May 20, 2026 08:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds more actionable authorization failure messages by including underlying native error details (Android Throwable cause / iOS NSUnderlyingErrorKey) so JS-side errors are less vague for troubleshooting and UX decisions.

Changes:

  • iOS: Append the underlying NSError’s localized description to the error message when present.
  • Android: Append the AuthorizationException cause’s localized message to the error message when present.
  • Add a patch changeset describing the behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/react-native-app-auth/ios/RNAppAuth.m Extends iOS error message formatting to include NSUnderlyingErrorKey details when available.
packages/react-native-app-auth/android/src/main/java/com/rnappauth/RNAppAuthModule.java Extends Android authorization exception rejection messages to include the throwable cause details.
.changeset/fuzzy-ravens-explain.md Declares a patch release for the improved error messages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .changeset/fuzzy-ravens-explain.md Outdated
bryceknz added 2 commits May 20, 2026 10:47
Keep user-facing auth error messages unchanged while surfacing underlying native diagnostics through error.nativeError.
Document the separate nativeError debug field without suggesting native details belong in user-facing messages.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

@bryceknz is attempting to deploy a commit to the formidable-labs Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 20, 2026

🦋 Changeset detected

Latest commit: 51c1241

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-native-app-auth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Pass Android nativeError metadata without dropping the original AuthorizationException, and align the changeset frontmatter with repo style.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

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.

5 participants