是否有效将AccountKit的电话身份验证与Firebase身份验证一起使用? (而不是支持Firebase的facebook auth)
使用以下代码:
private void handleFacebookAccessToken() {
AccessToken accessToken = AccountKit.getCurrentAccessToken();
String TAG = "TokenOperation";
Log.d(TAG, "handleFacebookAccessToken:" + accessToken);
AuthCredential credential = FacebookAuthProvider.getCredential(accessToken.getToken());
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d("", "signInWithCredential:success");
FirebaseUser user = mAuth.getCurrentUser();
Toast.makeText(DetailsInputDialog.this, "Firebase:" + user.getUid(), Toast.LENGTH_LONG).show();
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(DetailsInputDialog.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// ...
}
});
}
考虑accessToken不为null,Firebase身份验证失败会显示错误:
发生内部错误。 [无效的access_token,错误代码43。]