Can not authenticate in Facebook

坚强是说给别人听的谎言 提交于 2019-12-13 19:21:57

问题


I made an application in android in which I set Facebook authentication on button click. But when I click that button it comes back to my activity.

I know that problem is that : I can not log in to Facebook because I have already signed in with Facebook app in my device.

Then my question is how can I log in separately in my Android app and Facebook app?


回答1:


if u have used fb sdk than in class FacebookConnector change the login method as shown below

public void login() {
    if (!facebook.isSessionValid()) {
        facebook.authorize(this.activity, this.permissions,-1,new LoginDialogListener());
    }
}

may it works




回答2:


finally I solved the problem using this:

Open Facebook.java provided by facebook sdk and then i had changes like this:

public void authorize(Activity activity, String[] permissions,
            int activityCode, final DialogListener listener) {

        boolean singleSignOnStarted = false;

        mAuthDialogListener = listener;

      /*  // Prefer single sign-on, where available.
        if (activityCode >= 0) {
            singleSignOnStarted = startSingleSignOn(activity, mAppId,
                    permissions, activityCode);
        }
        // Otherwise fall back to traditional dialog.
        if (!singleSignOnStarted) {*/
            startDialogAuth(activity, permissions);
       // }
    }

Finally i can able to login in both app in my device



来源:https://stackoverflow.com/questions/10551475/can-not-authenticate-in-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!