简体   繁体   中英

How do I add a custom tab to a Facebook application profile page programmatically?

I am able to add custom tabs to my Facebook pages, by using the Graph API , [https://graph.facebook.com/page_id/tabs] and using HTTP POST.

However, I am unable to add custom tabs to my Facebook application's profile page. Infact the API, [https://graph.facebook.com/page_id/tabs], with HTTP GET also fails.

(I mean, I cannot even get the tabs for my Facebook application's profile page with the API.)

What am I doing wrong?

Here I am listing what I am trying to do:

  1. I get an access_token (say a1) for a user (admin_user) using the manage_pages permission.
  2. With this access_token (a1), I use Graph API, >[https://graph.facebook.com/me/accounts] and get back a list of pages (pages and application profile pages):

    { "data": [ { "name": "Bg", "access_token": " * ** ", "category": "Industrials", "id": " * **** " }, { "name": "Testapp2Pip", "access_token": " * ** * *** ", "category": "Application", "id": " ** * " },

  3. Now I use the Graph API, [https://graph.facebook.com/page_id/tabs]

Case 1. If I use the page_id for the background page (which is a normal page) and the corresponding access_token, I get back the tabs for the page.

Case 2. If I use the page_id for the Testapp2Pip page (which is an application profile page) and the corresponding access_token, I get an error:

{
    "error": {
        "message": "Unsupported get request.",
        "type": "GraphMethodException"
    }
}

What am I doing wrong here? How do I get the tabs for an application profile page? Also, I would actually want to add custom tabs to the application profile page by using Graph API.

Have you added the app to the app profile page, and/or double checked that it is added as an app? It seems odd, but you can add/remove the app from the apps own page. I'm guessing if the app isn't added, then it wouldn't have access to the page information.

An alternative option is to get an access token for the application, not the current user. This page has instructions for getting an access token for the app, instead of the user. Scroll down to the "App Login" section. http://developers.facebook.com/docs/authentication/

Okay, so this is a bug. I have filed the bug with Facebook .

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