Get phone number from FUIPhoneAuth instance
Step 1: Are you in the right place?
- For issues or feature requests related to the code in this repository file a GitHub issue.
- For general technical questions, post a question on StackOverflow tagged appropriately.
- For general Firebase discussion, use the firebase-talk google group
- For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel
Step 2: Describe your environment
- Objective C or Swift: Swift
- iOS version: >=11.1
- Firebase SDK version: 6.18.0
- FirebaseUI version: 8.4.2
- CocoaPods Version: 1.9.1
Step 3: Describe the problem:
We're using FUI for phone authentication. In the event on a merge conflict, where we do not get an AuthDataResult, I want to retrieve the phone number that the user provided from within the authUI(_:didSignInWith:error:) delegate function (before we do signIn, where we would then be able to get it directly from FIRAuth). What I think would make the most sense would be to add it as a property on the FUIPhoneAuth class similar to how we can get the email with authUI.providers.first?.email?(). Would this change be feasible?
Hey @morganchen12 could I get your thoughts on this as a short-term solution to #851? I know it will be some time before 851 can be implemented, so as a workaround I'd like to get the phone number to do a Firestore lookup for finding the UID manually. As far as I can tell, there isn't a way for us to intercept the phone number provided by the user in the FUI flow.
The best way to do that would be to fork FirebaseUI, add the workaround there, and point your CocoaPods installation to your fork.
Regardless of my use case, would it not make sense to expose a phoneNumber property on the FUIPhoneAuth class? It already has an email property- so it seems like providing the phone number would make sense. Is this thought misguided?
That thought makes sense. User identifiers (like phone/email) should be attached to the specific providers for those identifiers.