Firebase updatePhoneNumber失败:第一个参数";电话凭证“;必须是有效的电话凭据

Firebase updatePhoneNumber失败:第一个参数";电话凭证“;必须是有效的电话凭据,firebase,firebase-authentication,Firebase,Firebase Authentication,我正在尝试更新PhoneNumber并不断得到上面的以下错误。看着我印象深刻的文档,这是一种方法吗 Js: 我也尝试过在updateProfile方法中设置这个,但仍然没有成功 user.updateProfile({ displayName: displayName, photoURL: photoURL, phoneNumber: "+15618104444" }); updatePhoneNumber需要手机凭证,因为手机号码需要通过短信验证 // 'recaptcha-co

我正在尝试更新PhoneNumber并不断得到上面的以下错误。看着我印象深刻的文档,这是一种方法吗

Js:

我也尝试过在updateProfile方法中设置这个,但仍然没有成功

user.updateProfile({
  displayName: displayName,
  photoURL: photoURL,
  phoneNumber: "+15618104444"
});

updatePhoneNumber需要手机凭证,因为手机号码需要通过短信验证

// 'recaptcha-container' is the ID of an element in the DOM.
var applicationVerifier = new firebase.auth.RecaptchaVerifier(
    'recaptcha-container');
var provider = new firebase.auth.PhoneAuthProvider();
provider.verifyPhoneNumber('+16505550101', applicationVerifier)
    .then(function(verificationId) {
      var verificationCode = window.prompt('Please enter the verification ' +
          'code that was sent to your mobile device.');
      return firebase.auth.PhoneAuthProvider.credential(verificationId,
          verificationCode);
    })
    .then(function(phoneCredential) {
      return user.updatePhoneNumber(phoneCredential);
    });
// 'recaptcha-container' is the ID of an element in the DOM.
var applicationVerifier = new firebase.auth.RecaptchaVerifier(
    'recaptcha-container');
var provider = new firebase.auth.PhoneAuthProvider();
provider.verifyPhoneNumber('+16505550101', applicationVerifier)
    .then(function(verificationId) {
      var verificationCode = window.prompt('Please enter the verification ' +
          'code that was sent to your mobile device.');
      return firebase.auth.PhoneAuthProvider.credential(verificationId,
          verificationCode);
    })
    .then(function(phoneCredential) {
      return user.updatePhoneNumber(phoneCredential);
    });