firebase otp verification

So I was trying to use firebase OTP verification on phone no on my Magento store.
Here is the code

<script> // Your web app's Firebase configuration var firebaseConfig = { apiKey: "##############################", authDomain: "###########################", projectId: "#########################", storageBucket: "########################", messagingSenderId: "#################", appId: "#######################", measurementId: "#######################" }; // Initialize Firebase firebase.initializeApp(firebaseConfig); window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container', { 'size': 'normal', 'callback': function(response) { phoneAuth(); } } ); function phoneAuth() { //get the number var number=document.getElementById('number').value; //phone number authentication function of firebase //it takes two parameter first one is number,,,second one is recaptcha // firebase.auth().settings.appVerificationDisabledForTesting = true; firebase.auth().signInWithPhoneNumber(number,window.recaptchaVerifier).then(function (confirmationResult) { //s is in lowercase window.confirmationResult=confirmationResult; coderesult=confirmationResult; console.log(coderesult); alert("Message sent"); }).catch(function (error) { alert(error.message); }); } function codeverify() { var code=document.getElementById('verificationCode').value; coderesult.confirm(code).then(function (result) { alert("Successfully registered"); var user=result.user; console.log(user); }).catch(function (error) { alert(error.message); }); } </script> <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js" src_type="url"></script> <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-auth.js" src_type="url"></script> <form> <input type="text" id="number" placeholder="+91********"> <div id="recaptcha-container"></div> <button type="button" onclick="phoneAuth();">SendCode</button> </form><br> <h1>Enter Verification code</h1> <form> <input type="text" id="verificationCode" placeholder="Enter verification code"> <button type="button" onclick="codeverify();">Verify code</button> </form> 

So this code is working fine in isolated environment but when I integrated this into my page. It’s not working. I am little confused that where thing going wrong. All scripts are loading fine.

submitted by /u/LiveAlbatross619
[link] [comments]