Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Ionic firebase phone auth Cannot read property 'RecaptchaVerifier' of undefined

$
0
0

@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

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>