我正在尝试实施 Facebook 登录几天。我想实现单点登录(SSO),但是当我登录到本机 Facebook 应用程序时,我收到了以下消息:
"The page you requested cannot be displayed right now. it may be temporarily unavailable,
the link you clicked on may be broken or expired, or you may not have perrmission to view
this page".
我按照官方 facebook 指南登录。
LoginButton connectToFacebook = (LoginButton) findViewById(R.id.lbConnectToFacebook);
connectToFacebook.setReadPermissions(Arrays.asList("user_relationships"));
UiLifecycleHelper uiHelper = new UiLifecycleHelper(MainActivity.this, callback);
uiHelper.onCreate(savedInstanceState);
我也实现了:
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i("FACE", "Logged in...");
} else if (state.isClosed()) {
Log.i("FACE", "Logged out...");
}
}
private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
并覆盖 onActivityResult 方法,但这仅在我从本机 fb 应用程序注销时才有效,并且正如我所说,我不会不使用:
connectToFacebook.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
我想要单点登录。