1
我嘗試使用數字進行身份驗證(SMS /電話驗證),然後在其回調模塊成功()上調用Firebase自定義令牌身份驗證。所有的好,數字作品 - >火力地堡發送的驗證,實際上在包廂的用戶,但火力地堡的onComplete回調()沒有被調用。如果我叫signInWithCustomToken()的情況下直接通過位數去,它像它應該,的onComplete()它被稱爲所有。問題是什麼? 以下是我在我的的onCreate():Firebase自定義令牌身份驗證回調未調用
AuthConfig.Builder builder = new AuthConfig.Builder();
builder.withAuthCallBack(new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
signInWithCustomToken();
}
@Override
public void failure(DigitsException exception) {
}
});
authConfigDigits = builder.build();
Button digitsButton = (Button) findViewById(R.id.auth_button);
digitsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Digits.authenticate(authConfigDigits);
}
});
,然後我有自定義的令牌身份驗證方法signInWithCustomToken()本身:
private void signInWithCustomToken() {
String customToken = "eyJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJodHRwczovL2lkZW50aXR5dG9vbGtpdC5nb29nbGVhcGlzLmNvbS9nb29nbGUuaWRlbnRpdHkuaWRlbnRpdHl0b29sa2l0LnYxLklkZW50aXR5VG9vbGtpdCIsImV4cCI6MTQ5Mzg0MDU5MiwiaWF0IjoxNDkzODM2OTkyLCJpc3MiOiJmaXJlYmFzZS1hZG1pbnNkay0xOXBqY0Btb3ZlY2VudHJhbC0zOGUzYS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInN1YiI6ImZpcmViYXNlLWFkbWluc2RrLTE5cGpjQG1vdmVjZW50cmFsLTM4ZTNhLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwidWlkIjoic29tZS11aWQifQ.QdyviQ8vMhpMF7VJP949PdjVBwqM4EbZGxJvhCQtsRloJdIc16FPBG_RrBp2wZivWC-z1TIx1yctdMVGsoDAk5ptp-HlNyp5n31DyfZriGgo8zbhWln4RGG4wGYb7hSxGpyvm4STOM9N7TBBKt4lCZFYdpHVbT2idhr0hipxKCC_Ubjhwbjsfxrj5h59GHSyAdjw_yigNBHEtvsUfdGfzwKn_EW5qm5OAA0icCiqjnvsvW5RkwWKo7kWxqZT87-BoHsf5JguFeLGs0Ow9lgxAS2mSuuvni5qiYdLZdOKhu204Ctsty1pyFYrAWwWdnSrTWJwdkBx9xPgsE5UlipkRQ";
mFirebaseAuth.signInWithCustomToken(customToken)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.e(TAG, "Task is successfull");
openMainActivity();
} else {
Log.e(TAG, "Task failed");
}
}
});
}