According to Firebase documentation (https://firebase.google.com/docs/auth/android/phone-auth#send-a-verification-code-to-the-users-phone), there is callback
for handling the phone number authentication.
mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential credential) {
Log.d(TAG, "onVerificationCompleted:" + credential);
signInWithPhoneAuthCredential(credential);
}
@Override
public void onVerificationFailed(FirebaseException e) {
Log.w(TAG, "onVerificationFailed", e);
}
@Override
public void onCodeSent(String verificationId,
PhoneAuthProvider.ForceResendingToken token) {
Log.d(TAG, "onCodeSent:" + verificationId);
// Save verification ID and resending token so we can use them later
mVerificationId = verificationId;
mResendToken = token;
}
};
My question is on onCodeSent
method. It said on the doc here (https://firebase.google.com/docs/reference/android/com/google/firebase/auth/PhoneAuthProvider.ForceResendingToken)
that the token
can be used to force re-sending an SMS verification code. However, after doing some research on the doc I still don't know how.
I would like to ask how to use this token
to resend the SMS verification ?