简体   繁体   中英

Facebook {page-id}/tabs not working with v2 sdk

I have a web app that also integrates facebook login. Since v1 is available only until 30th april 2015, I've changed the JS calls to use v2 sdk (sdk.js) but the {page-id}/tabs request no longer works.

Facebook responds with an error:

code: 200

message: "(#200) Requires either an app access token, or a page access token for this Page"

type: "OAuthException"

This is the api call:

checkForInstalledApp: function(pageId, callbackFunction){
    FB.api(pageId+'/tabs/'+appid, function(response){
        if (response && !response.error) {
            callbackFunction(response.data.length > 0);
        }
    });
}

Changing back to all.js works just fine. Also the login is successful. Only {page-id}/tabs returns an error.. so far.

Anyone else encountered this issue?

According to the docs, you have to use a Page Token even for reading the tabs:

https://developers.facebook.com/docs/graph-api/reference/v2.2/page/tabs#read

I suggest trying it with a Page Token.

If you don´t know how to generate Page Tokens, the following links will help you:

Found the problem:

Even if in https://developers.facebook.com/docs/graph-api/reference/v1.0/page/tabs - Reading section - they specify that "A page access token is required to retrieve tabs for a Page" and we have the same thing mentioned in https://developers.facebook.com/docs/graph-api/reference/v2.2/page/tabs , if we check the changelog we see that "The tabs edge on the Page node now requires a Page token for GETs". So this is actually something v2 specific and it shouldn't appear in the v1 docs.

The tabs api call works if used like this: page.id+'/tabs?access_token='+page.access_token

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM