Firebase没有为Accessbase凭证交换AccessToken?

时间:2016-11-10 01:40:38

标签: android firebase facebook-login firebase-authentication

我是Firebase的新手,但我正在创建一个使用Facebook登录功能的应用程序,允许用户登录。我的代码可以检索用户登录时提供的AccessToken,但不会将其替换为Firebase凭据当我拨打handleFacebookAccessToken()

我的应用程序没有崩溃,因此没有堆栈跟踪。

private void handleFacebookAccessToken(AccessToken token) {
        Log.d("FB Token", "handleFacebookAccessToken:" + token);

        AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        Log.d("Sign-in Successful", "signInWithCredential:onComplete:" + task.isSuccessful());

                        // If sign in fails, display a message to the user. If sign in succeeds
                        // the auth state listener will be notified and logic to handle the
                        // signed in user can be handled in the listener.
                        if (!task.isSuccessful()) {
                            Log.w("Sign-in failed", "signInWithCredential", task.getException());
                        }

                        // ...
                    }
                });
    }

这就是我所说的方法

      mCallback = new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                AccessToken accessToken = loginResult.getAccessToken();
                final Profile profile = Profile.getCurrentProfile();
                handleFacebookAccessToken(accessToken);
}

0 个答案:

没有答案