Skip to content

Firebase Auth get VerificationId #104

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

Open
sinka49 opened this issue Nov 15, 2020 · 4 comments
Open

Firebase Auth get VerificationId #104

sinka49 opened this issue Nov 15, 2020 · 4 comments

Comments

@sinka49
Copy link

sinka49 commented Nov 15, 2020

please tell me how can I get the verificationId, after onCodeSent method called from firebase, to pass it to the method
Firebase.auth.signInWithCredential(authCredential = PhoneAuthProvider().credential("??", "smsCode")) if automatic authorization did not work for some reason?

On the first screen of authorization I call PhoneAuthProvider().verifyPhoneNumber(phone, phoneVerificationProvider).
If automatic authorization did not work I need to pass verificationId and smsCode manually to the signInWithCredential, but I cannot find how can I get verificationId

@nbransby
Copy link
Member

@Daeda88 do we need to expose extra APs for this?

@heckslam
Copy link

@nbransby I think yes, because the user only has a callback to send the SMS code again. It should look something like this:

override fun onCodeSent(verificationId: String, forceResending: PhoneAuthProvider.ForceResendingToken) {
                verificationProvider.codeSent(**verificationId**) { android.verifyPhoneNumber(phoneNumber, verificationProvider.timeout, verificationProvider.unit, verificationProvider.activity, this, forceResending) }
            }

@Daeda88
Copy link
Contributor

Daeda88 commented Dec 15, 2020

Iirc, the PhoneVerificationProvider intterface should have a suspend function that returns the verificationId. Implementing the interface allows you to respond. But looking t it now, it probably needs some changes to work properly.

Note that each platform handles verification very differently and as such it difficult to actually unify the behaviour.

@AKnght
Copy link

AKnght commented Apr 8, 2023

override fun onCodeSent(verificationId: String, forceResending: PhoneAuthProvider.ForceResendingToken) { verificationProvider.codeSent(**verificationId**) { android.verifyPhoneNumber(phoneNumber, verificationProvider.timeout, verificationProvider.unit, verificationProvider.activity, this, forceResending) } }

What was mentioned above is needed for Android. This would allow the saving of the verificationId for manually calling the 2nd exposed api method.

verificationProvider.codeSent(verificationId) is needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants