diff --git a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java index 0dd36723..c223144c 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -718,9 +718,9 @@ public class RNFirebaseAuth extends ReactContextBaseJavaModule { code = authException.getErrorCode(); message = authException.getMessage(); } catch (Exception e) { - Matcher matcher = Pattern.compile("\\[(.*?)\\]").matcher(message); + Matcher matcher = Pattern.compile("\\[(.*):.*\\]").matcher(message); if (matcher.find()) { - code = matcher.group().substring(2, matcher.group().length() - 2).trim(); + code = matcher.group(1).trim(); switch (code) { case "INVALID_CUSTOM_TOKEN": message = "The custom token format is incorrect. Please check the documentation.";