diff --git a/README.md b/README.md index 86b881bf..808e1426 100644 --- a/README.md +++ b/README.md @@ -390,7 +390,13 @@ try { } ``` -See example configurations for different providers below. +## Error messages + +- `service_configuration_fetch_error` - could not fetch the service configuration +- `authentication_failed` - user authentication failed +- `token_refresh_failed` - could not exchange the refresh token for a new JWT +- `registration_failed` - could not register +- `browser_not_found` (Android only) - no suitable browser installed #### Note about client secrets diff --git a/android/src/main/java/com/rnappauth/RNAppAuthModule.java b/android/src/main/java/com/rnappauth/RNAppAuthModule.java index 8b5fae35..b493bdae 100644 --- a/android/src/main/java/com/rnappauth/RNAppAuthModule.java +++ b/android/src/main/java/com/rnappauth/RNAppAuthModule.java @@ -7,6 +7,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.content.ActivityNotFoundException; import androidx.annotation.Nullable; import androidx.browser.customtabs.CustomTabsCallback; import androidx.browser.customtabs.CustomTabsClient; @@ -245,6 +246,8 @@ public void authorize( usePKCE, additionalParametersMap ); + } catch (ActivityNotFoundException e) { + promise.reject("browser_not_found", e.getMessage()); } catch (Exception e) { promise.reject("authentication_failed", e.getMessage()); } @@ -327,6 +330,8 @@ public void refresh( clientSecret, promise ); + } catch (ActivityNotFoundException e) { + promise.reject("browser_not_found", e.getMessage()); } catch (Exception e) { promise.reject("token_refresh_failed", e.getMessage()); }