我在Android上使用Facebook的webview登录时遇到了问题。
我按照教程操作,当用户安装了Facebook应用程序时,登录工作正常。但是,如果没有安装Facebook应用程序,则会弹出Facebook登录的webview;但是,在登录并接受权限后,webview只会简单地重定向回登录屏幕。它从未返回到我的应用程序。
有其他人遇到过这个问题吗?
FacebookSdk.sdkInitialize(this);
profileTracker = new ProfileTracker() {
@Override
protected void onCurrentProfileChanged(Profile profile, Profile profile2) {
if (profile2 != null) {
loggedIn(profile2);
} else {
loggedOut();
}
}
};
accessTokenTracker = new AccessTokenTracker() {
@Override
protected void onCurrentAccessTokenChanged(AccessToken accessToken, AccessToken accessToken2) {
Profile.fetchProfileForCurrentAccessToken();
}
};
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager,
new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
// App code
getProfileInfo();
}
@Override
public void onCancel() {
// App code
Log.e("Facebook Login", "Login Cancelled");
loggedOut();
}
@Override
public void onError(FacebookException exception) {
// App code
Log.e("Facebook Login", "Failed to Login " + exception.toString());
loggedOut();
}
});
在登录过程中查看没有筛选器的日志,我看到了几个可能相关的日志。
I/chromium﹕ [INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source: (0)
I/Auth.Core﹕ [TokenCache] Missing snowballing token: no granted scopes set.