问题
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.
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.
回答1:
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)
来源:https://stackoverflow.com/questions/52578119/convert-anonymous-acccount-to-phone-number-account