将匿名帐户转换为电话号码帐户 [英] Convert anonymous acccount to Phone Number Account
问题描述
Looking at the Firebase Authentication documentation it looks like one could only link an anonymous account to either email, Google or Facebook, but there is no specific statement regarding this question.
因为我无法在API中找到任何清晰的方法来转换为电话号码帐户,所以我想知道是否有可能实现这一目标.
Because I was unable to find any clear method in the API that would allow to convert to a phone number account, I was wondering whether or not there is any possibility to accomplish this.
推荐答案
You can also connect an anonymous account with an account for phone number authentication. Similar to all the example on the documentation you linked, you'll use the credential(withVerificationID: verificationCode:)
method of the provider. So something like:
guard let authentication = user.authentication else { return }
let credential = PhoneAuthProvider.credential(withVerificationID: authentication.idToken,
verificationCode: verificationCode)
这篇关于将匿名帐户转换为电话号码帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!