I am trying to implement firebase phone authentication in react js without using the firebase UI. How do I do it?
code
requestVerificationCode = () => {
const { phoneNumber } = this.state;
const appVerifier = new firebase.auth.RecaptchaVerifier(
"recaptcha-container"
);
if (phoneNumber < 10) {
this.setState({ error: true });
} else {
this.setState({ message: "Sending code ..." });
firebase
.auth()
.signInWithPhoneNumber(phoneNumber, appVerifier)
.then(confirmResult =>
this.setState({ confirmResult, verifying: true })
)
.catch(error =>
this.setState({
message: `Sign In With Phone Number Error: ${error.message}`
})
);
}
};
error
auth.esm.js:282 Uncaught K {code: "auth/argument-error", message: "reCAPTCHA container is either not found or already contains inner elements!"}
recaptcha-containerin your html