使用Firebase的Android应用程序的Facebook登录抛出异常:Facebook的debug_token响应失败

时间:2018-10-08 22:03:19

标签: android facebook firebase firebaseui

我正在尝试使用firebaseUI在我的Android应用中启用Facebook登录。我已经在Facebook开发人员页面和Firebase中配置了我的应用程序。 以下是处理Facebook访问令牌的代码-

import { createStore } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import reducers from './reducers.js';
import { clearState, loadState, saveState} from './localState.js';

const initialState = loadState();

const store = createStore(
  reducers,
  initialState,
  composeWithDevTools(applyMiddleware(...middlewares)), // not necessary, but nice for debugging
);

// save the state whenever the Redux store changes
store.subscribe(() => {
  const state = store.getState();
  if (state.user.signOut) {
    clearState();
  } else {
    saveState(store.getState());
  }
});

ReactDOM.render(
  <AppRoot store={store} />,
  document.getElementById('root')
);

但是当我尝试使用Facebook登录时,出现以下错误-

private void handleFacebookAccessToken(AccessToken token) {
        Log.d(TAG, "handleFacebookAccessToken:" + token);
        // [START_EXCLUDE silent]
        // [END_EXCLUDE]

        AuthCredential credential = FacebookAuthProvider.getCredential(token.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(TAG, "signInWithCredential:success");

                            mStatusTextView.setText("Logged in as: "+mAuth.getCurrentUser().getDisplayName());

                            // send to game menu
                            Intent intent = new Intent(SignInActivity.this, GameMenu.class);
                            startActivity(intent);

                        } else {
                            // If sign in fails, display a message to the user.
                            Log.w(TAG, "signInWithCredential:failure", task.getException());
                            Toast.makeText(SignInActivity.this, "Authentication failed." + task.getException(),
                                    Toast.LENGTH_LONG).show();
                            Log.d(TAG, "Logged in as : "+ mAuth.getCurrentUser());

                        }

                        // [START_EXCLUDE]
                        // [END_EXCLUDE]
                    }
                });
    }

我正在使用这些教程- https://firebase.google.com/docs/auth/android/google-signin?authuser=0

https://developers.facebook.com/docs/facebook-login/android

我已经验证了应用程序ID和应用程序秘密,还添加了我用来登录该应用程序测试人员的facebook帐户。

任何潜在客户都会受到赞赏。

0 个答案:

没有答案