Repository navigation
Conversation
Auth0.Android reports most failed renewals and exchanges as API_ERROR, so an access_denied from a post-login Action and a 5xx from the server reached JS as the same error. iOS already keeps the Auth0 error code. The rejection's userInfo now holds the AuthenticationException cause's error, error_description and statusCode, so apps can read them from error.json.userInfo. The CredentialsManagerError JSDoc documents the keys. The helper lives in the companion object and takes a map factory, so JVM tests can use JavaOnlyMap. AuthenticationException calls android.text.TextUtils, so the module's unit tests now return default values from the Android stubs.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Changes
On Android, Auth0.Android reports most failed refresh token exchanges as
API_ERROR. The bridge rejected with that code only, so anaccess_deniedfrom a post-login Action and a 5xx from the server reached JS as the same error. iOS already keeps the Auth0 error code.When
getCredentials,getApiCredentialsorgetSSOCredentialsfails with anAuthenticationExceptioncause, the rejection'suserInfonow holds that cause'serror,error_descriptionandstatusCode. Apps read it fromerror.json.userInfo.typeandcodedo not change, so existing checks forAPI_ERRORkeep working. The JSDoc ofCredentialsManagerErrordocuments the keys.authenticationErrorInfois in the companion object ofA0Auth0Moduleand takes a map factory, so JVM tests can pass aJavaOnlyMap. The existing passkey helpers use the same pattern.AuthenticationException.getDescription()callsandroid.text.TextUtils, which plain JVM tests have only as a stub. Soandroid/build.gradlenow setsunitTests.returnDefaultValues = true. The existing unit tests do not depend on the stubs and still pass.This change is Android-only. The iOS bridge already puts the Auth0 error code in
codefor a failed renewal, but does not passstatusCodeor the description.References
Testing
Unit tests:
A0Auth0ModuleCredentialsErrorTestchecks the three keys for an Auth0 error, and checks fornullwhen the cause is not an Auth0 error or is missing. All Android unit tests pass (:react-native-auth0:testDebugUnitTest).Manual check: I used the mock token endpoint from Android: getCredentials drops the Auth0 error code of a failed renewal, so access_denied cannot be told from a 5xx #1753 with the example app on an Android 16 emulator. Before the change, both responses gave
userInfo: null. After the change:{"statusCode":403,"error_description":"Denied by a post-login Action","error":"access_denied"} {"statusCode":503,"error_description":"Service unavailable","error":"server_error"}Not tested: iOS, because its code is unchanged and I had no Xcode available.
This change adds unit test coverage
This change has been tested on the latest version of the platform/language or why not
Checklist