-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
Needs Attentionplugin: authenticationFirebase AuthenticationFirebase Authenticationtype: bugNew bug reportNew bug report
Description
Issue
Firebase Authentication
I'm using the verifyBeforeUpdateEmail function that will automatically change the user email address after verification (clicking the email link in the new email inbox). If I try to change email to an account that exists, I don't get any exceptions/ error messages and the email is not sent, like a silent fail.
The expected result would be to get this error code: "auth/email-already-in-use"
I checked with the Firebase team and they get the correct error code when using plain Java Script.
try {
// First reauthenticate
const credential = EmailAuthProvider.credential(
user.email,
currentPasswordInput.current?.value
);
await reauthenticateWithCredential(auth.currentUser, credential);
// Then send a verify before update email
const newEmail = newEmailInput.current.value;
await verifyBeforeUpdateEmail(auth.currentUser, newEmail);
} catch (error: any) {
logError("Update email error:", error);
if (error.code === "auth/wrong-password") {
setError("The current password is incorrect");
} else if (error.code === "auth/invalid-credential") {
setError("The current password is incorrect");
} else if (error.code === "auth/email-already-in-use") {
setError("This email is already in use by another account");
} else if (error.code === "auth/invalid-email") {
// Set field-specific error for email
setFieldErrors({ newEmail: "The email address is not valid" });
} else {
// General error for other cases
setError("Failed to update email. Please try again.");
}
}Project Files
Javascript
Click To Expand
package.json:
"@react-native-firebase/app": "^23.4.1",
"@react-native-firebase/auth": "^23.4.1",
"@react-native-firebase/crashlytics": "^23.4.1",firebase.json for react-native-firebase v6:
# N/AiOS
Click To Expand
ios/Podfile:
- I'm not using Pods
- [] I'm using Pods and my Podfile looks like:
# N/AAppDelegate.m:
// N/AAndroid
Click To Expand
Have you converted to AndroidX?
- my application is an AndroidX application?
- I am using
android/gradle.settingsjetifier=truefor Android compatibility? - I am using the NPM package
jetifierfor react-native compatibility?
android/build.gradle:
// N/Aandroid/app/build.gradle:
// N/Aandroid/settings.gradle:
// N/AMainApplication.java:
// N/AAndroidManifest.xml:
<!-- N/A -->Environment
Click To Expand
react-native info output:
Expo app, no react-native CLI
"expo": "~53.0.23"
"react-native": "0.79.5"
- Platform that you're experiencing the issue on:
- [] iOS
- Android
- iOS but have not tested behavior on Android
- Android but have not tested behavior on iOS
- Both
react-native-firebaseversion you're using that has this issue:23.4.1
Firebasemodule(s) you're using that has the issue:Authentication
- Are you using
TypeScript?Y&5.8.3
Metadata
Metadata
Assignees
Labels
Needs Attentionplugin: authenticationFirebase AuthenticationFirebase Authenticationtype: bugNew bug reportNew bug report