Closed LittleCornerDev closed 3 years ago
Alternatively, is there a way to disable instant verification with this plugin? How do we stop getting null verification id from VerifyPhoneNumberAsync()
?
https://firebase.google.com/docs/auth/android/phone-auth has a code comment that mentions "Instant verification is applied and a credential is directly returned."
I then realized https://github.com/f-miyu/Plugin.FirebaseAuth/blob/master/Plugin.FirebaseAuth/Shared/PhoneNumberVerificationResult.cs returns an optional Credential I can use to log in when VerificationId is null.
Closing this issue.
Related to my comment/question on https://github.com/f-miyu/Plugin.FirebaseAuth/issues/29.
Due to null verification id, presumably because of "instant verification", it seems verification code is never sent to Android device again after the first time it is sent.
I am trying to save the
IAuthCredential
from the initial successful login withXamarin.Essentials.SecureStorage
in attempt to re-use it when the verification id comes back as null. However, deserializing the data into a string errors with "Error getting value fromProvider
" when usingNewtonsoft.Json.JsonConvert.DeserializeObject<T>()
and "deserialization of interface types is not supported" when usingSystem.Text.Json.JsonSerializer.Deserialize<T>()
.I tried using
PhoneAuthCredentialWrapper
as the data type instead ofIAuthCredential
, butPhoneAuthCredentialWrapper
"does not exist in the namespace".I hear it is possible to write a custom JSON converter, but it has to be annotated in the concrete class implementation: https://www.c-sharpcorner.com/UploadFile/20c06b/deserializing-interface-properties-with-json-net/
Please advise. How have people successfully implemented logging in by phone more than once with a real phone number on an Android device? Is it possible to access
PhoneAuthCredentialWrapper
? Do I need to write my own custom wrapper class? If so, how can it inherit fromPhoneAuthCredentialWrapper
if it is inaccessible?