【发布时间】:2017-06-22 01:41:37
【问题描述】:
根据 Firebase 文档 (https://firebase.google.com/docs/auth/android/phone-auth#send-a-verification-code-to-the-users-phone),有 callback 用于处理电话号码身份验证。
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;
}
};
我的问题是关于onCodeSent 方法。它在这里的文档上说(https://firebase.google.com/docs/reference/android/com/google/firebase/auth/PhoneAuthProvider.ForceResendingToken)
token 可用于强制重新发送短信验证码。但是,在对文档进行了一些研究之后,我仍然不知道如何。
请问如何使用这个token重新发送短信验证?
【问题讨论】:
-
当然感谢您的帮助。 :)
标签: android firebase firebase-authentication sms-verification