why do i face this error when sending otp with firebase
these are codes
import { RecaptchaVerifier, getAuth, signInWithPhoneNumber} from 'firebase/auth'; import { initializeApp } from 'firebase/app'
sendCode() {
window.appVerifier = new RecaptchaVerifier(
"recaptcha-container",
{
size: "invisible",
}
, getAuth()
);
const appVerifier = window.appVerifier;
this.setState({
mobile: this.props.mobile,
disabled: false,
});
var number = "+65 " + this.props.mobile;
console.log(number);
signInWithPhoneNumber(getAuth(), number, appVerifier)
.then(function (confirmationResult) {
console.log("Success");
// SMS sent. Prompt user to type the code from the message, then sign the
// user in with confirmationResult.confirm(code).
window.confirmationResult = confirmationResult;
this.setState({confirmResult: confirmationResult});
console.log(confirmationResult);
componentDidMount() {
initializeApp(firebaseConfig);
}
<div id="recaptcha-container" />
anybody can let me know where im doing wrong please ?
Thank you!
2
Answers
maybe this would help,
according to firebase docs first parameter is
Auth
thencontainerOrId
thenRecaptchaParameters