window.FirebasePlugin.verifyPhoneNumber function response unable to use it












2















I have implemented firebase phone authentication mechanism to login user with following
code:



(<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
//alert("sms sent successfully"+ credential.verificationId);
//this.verificationId = credential.verificationId;
let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
modal.present();

}, error => {
alert(JSON.stringify(error));
console.log("error: " + error);
});
}


but credential.verificationId value can't able to store or send to another page



verify() {
this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));})
}


How to resolve above error?










share|improve this question





























    2















    I have implemented firebase phone authentication mechanism to login user with following
    code:



    (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
    //alert("sms sent successfully"+ credential.verificationId);
    //this.verificationId = credential.verificationId;
    let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
    modal.present();

    }, error => {
    alert(JSON.stringify(error));
    console.log("error: " + error);
    });
    }


    but credential.verificationId value can't able to store or send to another page



    verify() {
    this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
    alert("u"+JSON.stringify(this.signInCredential));
    firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
    alert("err"+JSON.stringify(error));})
    }


    How to resolve above error?










    share|improve this question



























      2












      2








      2








      I have implemented firebase phone authentication mechanism to login user with following
      code:



      (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
      //alert("sms sent successfully"+ credential.verificationId);
      //this.verificationId = credential.verificationId;
      let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
      modal.present();

      }, error => {
      alert(JSON.stringify(error));
      console.log("error: " + error);
      });
      }


      but credential.verificationId value can't able to store or send to another page



      verify() {
      this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
      alert("u"+JSON.stringify(this.signInCredential));
      firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
      alert("err"+JSON.stringify(error));})
      }


      How to resolve above error?










      share|improve this question
















      I have implemented firebase phone authentication mechanism to login user with following
      code:



      (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
      //alert("sms sent successfully"+ credential.verificationId);
      //this.verificationId = credential.verificationId;
      let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
      modal.present();

      }, error => {
      alert(JSON.stringify(error));
      console.log("error: " + error);
      });
      }


      but credential.verificationId value can't able to store or send to another page



      verify() {
      this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
      alert("u"+JSON.stringify(this.signInCredential));
      firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
      alert("err"+JSON.stringify(error));})
      }


      How to resolve above error?







      android firebase ionic-framework ionic3 firebase-authentication






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 17 '18 at 16:08









      Phonolog

      3,72231744




      3,72231744










      asked Nov 15 '18 at 12:27









      suniel kalwanisuniel kalwani

      224317




      224317
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You should get the parameters from the nav params, directly it won't work.
          try



          constructor(public params: Navparams){
          }
          verify() {
          let verificationId = params.get("verificationId");
          this.signInCredential =
          firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
          alert("u"+JSON.stringify(this.signInCredential));
          firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
          {
          alert("check"+JSON.stringify(info));}, (error) => {
          alert("err"+JSON.stringify(error));
          })
          }


          i hope this will help you.



          For your reference check this article
          https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef






          share|improve this answer


























          • I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable

            – suniel kalwani
            Nov 19 '18 at 12:23













          • Are you getting any error while storing credential? and you are trying open a modal, is it opening?

            – Ramesh Krishnan
            Nov 19 '18 at 12:58











          • i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string

            – suniel kalwani
            Nov 19 '18 at 13:09











          • @sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?

            – Ramesh Krishnan
            Nov 19 '18 at 13:17











          • and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage

            – Ramesh Krishnan
            Nov 19 '18 at 13:17













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319513%2fwindow-firebaseplugin-verifyphonenumber-function-response-unable-to-use-it%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You should get the parameters from the nav params, directly it won't work.
          try



          constructor(public params: Navparams){
          }
          verify() {
          let verificationId = params.get("verificationId");
          this.signInCredential =
          firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
          alert("u"+JSON.stringify(this.signInCredential));
          firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
          {
          alert("check"+JSON.stringify(info));}, (error) => {
          alert("err"+JSON.stringify(error));
          })
          }


          i hope this will help you.



          For your reference check this article
          https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef






          share|improve this answer


























          • I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable

            – suniel kalwani
            Nov 19 '18 at 12:23













          • Are you getting any error while storing credential? and you are trying open a modal, is it opening?

            – Ramesh Krishnan
            Nov 19 '18 at 12:58











          • i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string

            – suniel kalwani
            Nov 19 '18 at 13:09











          • @sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?

            – Ramesh Krishnan
            Nov 19 '18 at 13:17











          • and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage

            – Ramesh Krishnan
            Nov 19 '18 at 13:17


















          0














          You should get the parameters from the nav params, directly it won't work.
          try



          constructor(public params: Navparams){
          }
          verify() {
          let verificationId = params.get("verificationId");
          this.signInCredential =
          firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
          alert("u"+JSON.stringify(this.signInCredential));
          firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
          {
          alert("check"+JSON.stringify(info));}, (error) => {
          alert("err"+JSON.stringify(error));
          })
          }


          i hope this will help you.



          For your reference check this article
          https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef






          share|improve this answer


























          • I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable

            – suniel kalwani
            Nov 19 '18 at 12:23













          • Are you getting any error while storing credential? and you are trying open a modal, is it opening?

            – Ramesh Krishnan
            Nov 19 '18 at 12:58











          • i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string

            – suniel kalwani
            Nov 19 '18 at 13:09











          • @sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?

            – Ramesh Krishnan
            Nov 19 '18 at 13:17











          • and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage

            – Ramesh Krishnan
            Nov 19 '18 at 13:17
















          0












          0








          0







          You should get the parameters from the nav params, directly it won't work.
          try



          constructor(public params: Navparams){
          }
          verify() {
          let verificationId = params.get("verificationId");
          this.signInCredential =
          firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
          alert("u"+JSON.stringify(this.signInCredential));
          firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
          {
          alert("check"+JSON.stringify(info));}, (error) => {
          alert("err"+JSON.stringify(error));
          })
          }


          i hope this will help you.



          For your reference check this article
          https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef






          share|improve this answer















          You should get the parameters from the nav params, directly it won't work.
          try



          constructor(public params: Navparams){
          }
          verify() {
          let verificationId = params.get("verificationId");
          this.signInCredential =
          firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
          alert("u"+JSON.stringify(this.signInCredential));
          firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
          {
          alert("check"+JSON.stringify(info));}, (error) => {
          alert("err"+JSON.stringify(error));
          })
          }


          i hope this will help you.



          For your reference check this article
          https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 19 '18 at 13:37

























          answered Nov 19 '18 at 11:14









          Ramesh KrishnanRamesh Krishnan

          216




          216













          • I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable

            – suniel kalwani
            Nov 19 '18 at 12:23













          • Are you getting any error while storing credential? and you are trying open a modal, is it opening?

            – Ramesh Krishnan
            Nov 19 '18 at 12:58











          • i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string

            – suniel kalwani
            Nov 19 '18 at 13:09











          • @sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?

            – Ramesh Krishnan
            Nov 19 '18 at 13:17











          • and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage

            – Ramesh Krishnan
            Nov 19 '18 at 13:17





















          • I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable

            – suniel kalwani
            Nov 19 '18 at 12:23













          • Are you getting any error while storing credential? and you are trying open a modal, is it opening?

            – Ramesh Krishnan
            Nov 19 '18 at 12:58











          • i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string

            – suniel kalwani
            Nov 19 '18 at 13:09











          • @sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?

            – Ramesh Krishnan
            Nov 19 '18 at 13:17











          • and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage

            – Ramesh Krishnan
            Nov 19 '18 at 13:17



















          I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable

          – suniel kalwani
          Nov 19 '18 at 12:23







          I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable

          – suniel kalwani
          Nov 19 '18 at 12:23















          Are you getting any error while storing credential? and you are trying open a modal, is it opening?

          – Ramesh Krishnan
          Nov 19 '18 at 12:58





          Are you getting any error while storing credential? and you are trying open a modal, is it opening?

          – Ramesh Krishnan
          Nov 19 '18 at 12:58













          i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string

          – suniel kalwani
          Nov 19 '18 at 13:09





          i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string

          – suniel kalwani
          Nov 19 '18 at 13:09













          @sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?

          – Ramesh Krishnan
          Nov 19 '18 at 13:17





          @sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?

          – Ramesh Krishnan
          Nov 19 '18 at 13:17













          and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage

          – Ramesh Krishnan
          Nov 19 '18 at 13:17







          and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage

          – Ramesh Krishnan
          Nov 19 '18 at 13:17






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319513%2fwindow-firebaseplugin-verifyphonenumber-function-response-unable-to-use-it%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine