public override void OnCodeSent(string verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) { var result = new PhoneNumberVerificationResult { VerificationId = verificationId }; _tcs.SetResult(result); }
public override void OnVerificationCompleted(PhoneAuthCredential credential) { var result = new PhoneNumberVerificationResult { AuthCredential = credential }; _tcs.SetResult(result); }
/// <summary> /// Attempts to sign in to Firebase with the given phone number, or provides a verification ID if unable. /// </summary> /// <param name="phoneNumber">The phone number for the account the user is signing up for or signing into. Make sure to pass in a phone number with country code prefixed with plus sign ('+').</param> /// <returns>PhoneNumberSignInResult containing either a verification ID or an IAuthResultWrapper</returns> public async Task <PhoneNumberSignInResult> SignInWithPhoneNumberAsync(string phoneNumber) { var completionHandler = new PhoneNumberVerificationCallbackWrapper(); PhoneAuthProvider.Instance.VerifyPhoneNumber(phoneNumber, 60, TimeUnit.Seconds, CrossCurrentActivity.Current.Activity, completionHandler); PhoneNumberVerificationResult result = null; try { result = await completionHandler.Verify(); } catch (Exception ex) { throw GetFirebaseAuthException(ex); } if (result.AuthCredential != null) { IAuthResult authResult = null; try { authResult = await _auth.SignInWithCredentialAsync(result.AuthCredential); } catch (Exception ex) { throw GetFirebaseAuthException(ex); } IFirebaseAuthResult authResultWrapper = new FirebaseAuthResult(authResult); return(new PhoneNumberSignInResult() { AuthResult = authResultWrapper }); } else { return(new PhoneNumberSignInResult() { VerificationId = result.VerificationId }); } }
private async void SentOTP(string Number) { //await LoginYummyButton.ScaleTo(.8); //LoginYummyButton.ScaleTo(1); verificationResult = await CrossFirebaseAuth.Current.PhoneAuthProvider.VerifyPhoneNumberAsync(CrossFirebaseAuth.Current.Instance, "+91" + Number); }