Pages.isFan returns the wrong signature

I am working on an iFrame application on Facebook canvas and I will lose my mind. I am trying to check if the user is a fan of the page on which the application is located so that I can enable or disable the vote.

I am using the following code:

function CheckFan() {
FB.init({
    appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
    status: true, // check login status
    cookie: true, // enable cookies to allow the server to access the session
    xfbml: true  // parse XFBML
});


FB.api({ method: 'pages.isFan', page_id: '145116742177104' }
    , function(resp) {
        if (resp) { $('#main_frame').show(); $('#non_fan').hide(); }
        else { $('#main_frame').hide(); $('#non_fan').show(); }
    });
}

This JS SDK pushes me against the wall, and calling the documentation "incomplete" is an insult to incompleteness.

Any input will be entered.

Thank! -Elad

+3
source share
1 answer

This is deprecated by Facebook. A new alternative to the Graph API will be quickly available by the time the application is deployed.

I am currently using FQL:

FB.api({ method: 'fql.query', query: 'SELECT uid FROM page_fan WHERE uid= ' + user_id + ' AND page_id=145116742177104' },
    function(result) {
        if (result.length)
        { $('.main_frame').show(); $('#non_fan').hide(); } else { $('.main_frame').hide(); $('#non_fan').show(); }
    });
+2
source

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


All Articles