@Pratikjaiswa15 wrote:
I am trying to use firebase phone auth in ionic 4 with invisible Recaptcha. I have set ReCaptcha properties to window object. But still getting the following error
TypeError: Cannot read property ‘RecaptchaVerifier’ of undefined
What has gone wrong? Thank you in advance
window.service.ts
get windowRef(){ return window; }
page.ts
constructor(public win :WindowService){} ngOnInit() { this.windowRef = this.win.windowRef; this.windowRef.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container', { 'size': 'invisible', // error on this line }); } send(){ const appVerifier = this.windowRef.recaptchaVerifier; this.afauth.signInWithPhoneNumber("+XXXXXXXXXXXX", appVerifier).then(function (success) { // code sent }).catch(err =>{console.log(err}) }
.html
<div id="recaptcha-container"></div>
Attempt 2
this.recaptchaVerifier =new firebase.auth.RecaptchaVerifier('sign-in-button', { 'size': 'invisible', // same error });
Posts: 1
Participants: 1