I am developing a mobile application based on React Native framework. Earlier, the Phone Authentication is working properly. But now it’s showing me error ([Error: [auth/internal-error] An internal error has occurred, please try again.]). I have tried many changes in firebase configurations and updated my code as well but still showing same issue. I’ll be very thankful who ever sorts this out.
Authentication Script:
async function signInWithPhoneNumber() {
const phoneNumber = `${countryCode}${contact}`;
if (!contact.trim() || !password.trim() || !confirmPassword.trim() || !name.trim()) {
Alert.alert('Register Failed', 'Please Enter all required fields.');
return;
}
if (contact.trim().length < 10) {
Alert.alert('Invalid phone number', 'Please enter a valid phone number');
return;
}
if (password !== confirmPassword) {
Alert.alert('Password Mismatch', 'Passwords do not match. Please try again.');
return;
}
const userExists = await checkUserExists(phoneNumber);
if (userExists) {
Alert.alert('Registration Error', 'This phone number is already registered.');
return;
}
try {
const confirmation = await auth().signInWithPhoneNumber(phoneNumber);
setConfirm(confirmation);
} catch (error) {
Alert.alert('Failed to send OTP', 'There was a problem sending the verification code.');
console.log(error);
}
}
Output: LOGĀ [Error: [auth/internal-error] An internal error has occurred, please try again.]