我在Android上使用Facebook的webview登录出现问题。
我已经按照教程进行操作,并且在用户安装了Facebook应用程序后,登录即可完美运行。未安装Facebook应用程序时,将弹出Facebook登录的Web视图。但是,登录并接受权限后,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.
引起问题的原因是我覆盖了登录按钮的onclicklistener来调用LoginManager的登录功能。只是不要。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句