FIREBASE phoneAuth(LinkWithPhoneNumber)。稍后如何在Firebase Web中更改用户的链接电话号码。 (nodejs,Create-react-app)? [英] FIREBASE phoneAuth ( LinkWithPhoneNumber ) . How to change a user's linked phone number later in Firebase Web. ( nodejs, Create-react-app )?
问题描述
我在我的create-react-app项目中使用firebase。
出于注册目的,我使用
firebaseAuth()。createUserWithEmailAndPassword(电子邮件,密码)
I am using firebase in my create-react-app project.
For SignUp purpose I am using
firebaseAuth().createUserWithEmailAndPassword(email, password)
然后在注册后我将其phoneNumber保存在localStorage中,然后使用它们将其重定向到PhoneAuth页面
Then after SignUp I am saving their phoneNumber in localStorage and redirect them to PhoneAuth page using then I am using this function
export function PhnAuth(phone) {
window.recaptchaVerifier = new firebaseAuth.RecaptchaVerifier('recaptcha-container',{'size': 'small'});
return firebaseAuth().currentUser.linkWithPhoneNumber(phone, window.recaptchaVerifier)
.then(function (confirmationResult) {
window.confirmationResult = confirmationResult;
}).catch(function (error) {
})
}
重新捕获之后,所有完成后,我成功将用户的电子邮件与他们的电话号码关联起来。但是,以后如何更新该phoneNumber?我找不到有关在文档中更新链接的电话号码的任何信息。
After the recaptcha and all done I get the I successfully linked the user's email with their phoneNumber. But how to update that phoneNumber later ? I couldn't find anything regarding updating a linked phoneNumber in the docs.
推荐答案
有一个 updatePhoneNumber <为此,请在
User
对象上使用/ code>方法。
There's an updatePhoneNumber
method on the User
object for that purpose.
请参见参考文档和有关更新用户个人资料的文档。
请注意,为此,需要 phoneCredential
,这意味着它必须是经过验证的电话号码。请参阅如何更新Firebase中的用户电话号码。 auth(js,ts)。
Note that you'll need a phoneCredential
for this, meaning that this must be a verified phone number. See how to update user phone number in firebase.auth (js, ts).
如果您想更新用户的电话号码而不进行验证,可以通过Admin SDK来完成。有关此示例,请参阅如何更新电话号码在NodeJS中进行Firebase身份验证?
If you want to update a user's phone number without verifying it, that can be done from the Admin SDK. For an example of this, see How to update phone number on Firebase Authentication in NodeJS?
这篇关于FIREBASE phoneAuth(LinkWithPhoneNumber)。稍后如何在Firebase Web中更改用户的链接电话号码。 (nodejs,Create-react-app)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!