How to Detect User logged as Page, FB.getLoginStatus doesn't work?

耗尽温柔 提交于 2019-12-23 03:51:26

问题


we have thic piece of code:

            checkStatus: function() {

            var self = this;

            FB.getLoginStatus(function(response) {
                if (response.status === 'connected') {

                    self.isPage = false;
                    dojo.publish('fb/loginStatus/connected', response.authResponse);

                    if (self.UserRecord === null) {

                        self.buildAll(response.authResponse);

                    } else if (self.UserRecord.user_fid !== response.authResponse.userID){

                        self.clearAll();
                        setTimeout(function(){ self.buildAll(); }, 100);
                    }

                } else {

                    if (response.status === 'not_authorized') {
                        dojo.publish('fb/loginStatus/logged', response);
                    } else {

                        dojo.publish('fb/loginStatus/notLogged', response);
                    }
                }
            },true);
        },

All work fine, till user enter our app logged as facebook page, Fb.getLoginStatus doesn't fire up it's callback.

And my question is, how to detect, or do something else to handle this case in application ?

Cheers, Paul


回答1:


I'm betting this is a bug. There was a similar issue with FB.getLoginStatus last year when user was in sandbox mode. Anyways, you can get a user to switch back to their normal user with :

FB.login(function(response) {
    // response handler
});

It will display a prompt that says "You are using Facebook as Different User" and ask you to switch back to standard user.

Another option is to display one of the facebook social widgets after a certain timeout (e.g. like button). Instead of displaying a like button, it comes up with a link that says "Switch back to Normal User to use this social widget."

Hope these suggestions help.



来源:https://stackoverflow.com/questions/10312395/how-to-detect-user-logged-as-page-fb-getloginstatus-doesnt-work

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