FB.getLoginStatus always returns status = 'unknown'

If I am registered to facebook.com, I expect that calling FB.getLoginStatus will return the status = 'not_authorized'. Instead, it returns status = 'unknown', even if I pass true for the force parameter.

If I call FB.login and then call FB.getLoginStatus, I get status = 'connected'. Has the meaning.

If I call FB.login, reload the page and then call FB.getLoginStatus, I get the status = 'unknown'. It makes no sense. If I add “truth” as the second parameter (ie Strength), I still get the status = “unknown”. (I expect status = 'not_authorized' in this case.)

There seems to be no way to get status = 'not_authorized' in practice.

Am I doing something wrong? Is this an error in FB.getLoginStatus or its documentation?

Here is the minimum test page: http://pastebin.com/NqiBXni2

Context:

I am writing a website widget that displays posts for a public Facebook page. (Access to it is possible without a user request through an access token for applications.) Each message has a “Like” / “Unlike” link. In order to determine whether to show “Like” or “Unlike”, I need to know what the Facebook user is viewing to view so I can check if he is in the message list.

+2
source share
3 answers

You may have disabled third-party cookies.

+8
source

And to talk a bit about David's answer, Facebook describes it as “ by design ” when third-party cookies are disabled.

Unfortunately, I am not sure of the most graceful handling of this - at least on my site I need an oath token to download some data.

+1
source

I had a similar problem even when the third-party cookie is not disabled. What I did to get around this is: if I get an “unknown” response, I will call FB.login and inside to call FB.loginStatus again. This time, FB returned the correct value.

0
source

Source: https://habr.com/ru/post/1202465/


All Articles