title: Firebase Phone authentication and Linking
body: <p>i'm trying to link my phone number with my email password authentication. So i build my registration using below steps:</p>
  
  <ol>
  <li>User enters email address and password.</li>
  <li>then i call <code>firebase.auth().createUserWithEmailAndPassword(values.email, values.password)</code></li>
  <li>then I need to link current account with phone number so I'm using <code>firebase.auth().currentUser.linkWithPhoneNumber("+xxxxxxxxxx", xxx)</code></li>
  </ol>
  
  <p>however, i don't see any linking. 2 accounts created in my firebase console and the current user have phone number only in his details. When I log in with email and password again and check user details the phone number is not there !!!</p>
  
  <p>Please find my code below:</p>
  
  <pre><code>onSubmit(values) {
      this.props.firebase.auth().createUserWithEmailAndPassword(values.email, values.password).then((user) =&gt; {
          //send recaptchaverifier
          window.recaptchaVerifier.verify();
  
      }).catch((error) =&gt; {
          console.log(error);
      });
  }
  
  
  window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('submit-button', {
          'size': 'invisible',
          'callback': function(response){
           //called when we call "window.recaptchaverifier.verify() in 
           //onSubmit function
              var xxx = window.recaptchaVerifier;
  
              this.props.firebase.auth().currentUser.linkWithPhoneNumber("+xxxxxxxx", xxx)
                  .then((verificationId) =&gt; {
                      console.log('inside');
                      console.log(resp);
                      var verificationCode = window.prompt('Please enter the verification ' +
                          'code that was sent to your mobile device.');
                      return firebase.auth.PhoneAuthProvider.credential(resp.verificationId,
                          verificationCode);
                  }).then((phoneCredential) =&gt; {
                  console.log("RESULT OF AUTH", phoneCredential);
                  console.log("USER INFO: ", this.props.firebase.auth().currentUser);
                  return this.props.firebase.auth().signInWithCredential(phoneCredential)
              }).catch((error) =&gt; {
                  console.log("ERRORS: ", error);
              }).catch((error) =&gt; {
                  console.log("ERROR", error)
              });
          }.bind(this)
      });
  </code></pre>