如何检测用户登录页面,FB.getLoginStatus不起作用? [英] How to Detect User logged as Page, FB.getLoginStatus doesn't work?

查看:1049
本文介绍了如何检测用户登录页面,FB.getLoginStatus不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些代码:

  checkStatus:function(){

var self =这个

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'回应);
}
}
},true);
},

一切正常,直到用户输入我们的应用程序登录为Facebook页面,Fb .getLoginStatus不会启动它的回调。



我的问题是,如何检测或执行其他处理这种情况的应用程序?



干杯,
保罗

解决方案

我打赌这是一个bug 。去年,当用户处于沙箱模式时,FB.getLoginStatus有一个类似的问题。
无论如何,您可以通过以下方式获得用户切换回正常用户:

  FB.login(function响应){
//响应处理程序
});

它将显示一条提示,表示您正在使用Facebook作为不同的用户,并要求您切换返回标准用户。



另一个选项是在某个超时后显示一个Facebook社交小部件(例如按钮)。而不是显示一个类似的按钮,它出现一个链接,说切换回正常用户使用这个社交小部件。



希望这些建议有帮助。 p>

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

解决方案

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.

这篇关于如何检测用户登录页面,FB.getLoginStatus不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆