FB.getLoginStatus总是返回status ='unknown' [英] FB.getLoginStatus always returns status='unknown'
问题描述
如果我登录facebook.com,我希望调用FB.getLoginStatus会返回status ='not_authorized'。相反,它返回status ='unknown',即使我为'force'参数传递true。
If I am logged into facebook.com, I expect a call to FB.getLoginStatus will return a status='not_authorized'. Instead it returns status='unknown', even if I pass true for the 'force' parameter.
如果我调用FB.login,然后调用FB.getLoginStatus,我得到status ='connected'。有道理。
If I call FB.login, and then call FB.getLoginStatus, I get status='connected'. Makes sense.
如果我调用FB.login,重新加载页面,然后调用FB.getLoginStatus,我得到status ='unknown'。没有意义。如果我添加'true'作为第二个参数(即force),我仍然得到status ='unknown'。 (在这种情况下,我希望status ='not_authorized'。)
If I call FB.login, reload the page, and then call FB.getLoginStatus, I get status='unknown'. Does not make sense. If I add 'true' as the second parameter (i.e. force), I still get status='unknown'. (I expect status='not_authorized' in this case.)
在实践中似乎没有办法获得status ='not_authorized'。
There doesn't seem to be a way to get status='not_authorized' in practice.
我做错了什么?这是FB.getLoginStatus或其文档中的错误吗?
Am I doing something wrong? Is this a bug in FB.getLoginStatus or its documentation?
这是一个最小测试页:
http://pastebin.com/NqiBXni2
Here is a minimal test page: http://pastebin.com/NqiBXni2
背景:
我正在编写一个网站小部件,显示公共Facebook页面的帖子。 (这可以在不通过app访问令牌提示用户的情况下访问。)每个帖子都有一个赞/不同链接。为了确定是否显示喜欢或不喜欢,我需要知道浏览用户的Facebook ID是什么,以便我可以检查它是否在帖子的喜欢列表中。
I am writing a website widget that displays posts for a public Facebook page. (This can be accessed without prompting the user via an app access token.) Each post has a "Like" / "Unlike" link. In order to determine whether to display "Like" or "Unlike", I need to know what the browsing user's Facebook ID is so that I can check whether it is in the post's list of likes.
推荐答案
也许您已禁用第三方Cookie。
Maybe you have third party cookies disabled.
这篇关于FB.getLoginStatus总是返回status ='unknown'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!