-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retrieving verificationId and code from credential object #861
Conversation
…g it along to cordova
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to submit a pull request! I left some comments in the proposed code. Do we need the same changes on iOS?
@briantq iOS changes are not needed, instant verification only works on Android according to the Firebase API: https://firebase.google.com/docs/auth/ios/phone-auth |
@manuelsc There are definitely half a dozen ways to do thing. I personally would look for the known list of fields, verify they exist, then get their value rather than trying to guess on the length of their values. I think trying to rely on value length could be more brittle than field names. That being said, if you think that is a better solution you put the effort into creating the PR so I don't mind approving. |
…etrieval was successfull
@briantq I mean it's tricky and I understand your concern. But I think relying on the length is somewhat more reliable than relying on an obfuscated name. Those names could change with any release while using the size is constant. Otherwise we could find ourself in updating the obfuscated names after every firebase update. Sure length is not an absolute viable option either but we would only need to change this if other string fields get included that share a similar length. That's far more unlikely than the obfuscated names being changed. |
@manuelsc to start with, I want to make sure to reiterate, I am ok merging with the implementation. For the acedemic discussion, I think the obfucsated name is better because
In the end, I think changes will be rare which is why I am ok with the implementation. The big advantage to me is 3a. |
Updated API doc for pull request #861
See discussion @ #756
This basically retrieves the verificationId and code from the onVerificationCompleted credential. Meaning we can use verificationId and code to finally solve the instant verification issue.
var code = credential.instantVerification ? credential.code : inputField.value.toString() ;
If instantVerification is true we get the code directly from firebase without the need to go through an sms process. Otherwise use the sms code entered by the user.