小编Boo*_*tak的帖子

如何在Firebase Phone Authentication Android中重新发送短信验证?

根据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;
    }
};
Run Code Online (Sandbox Code Playgroud)

我的问题是关于onCodeSent方法.它在此处的文档中说(https://firebase.google.com/docs/reference/android/com/google/firebase/auth/PhoneAuthProvider.ForceResendingToken)

token可用于强制重发的SMS验证码.但是,在对doc进行一些研究后,我仍然不知道如何.

我想问一下如何使用它token重新发送短信验证?

android firebase firebase-authentication sms-verification

14
推荐指数
1
解决办法
1万
查看次数