1
votes

I have a Facebook app and want to add it to a page programmatically without user interaction. Exactly what this page does:

https://www.facebook.com/add.php?api_key=[my_app_id]&pages=1&page=[page_id]

But without the user having to confirm it. This is important as some users might need to do this for 100s of pages so confirming every single one is not really an option.

I searched around for this for a while and found some posts that suggest this should work:

https://graph.facebook.com/[page_id]/tabs?app_id=[app_id]&method=post&access_token=[access_token]

But I am always getting an

OAuthException: "(#10) Application does not have permission for this action"

When I check the permissions via https://graph.facebook.com/me/permissions?access_token=[...], I am getting this:

{
    "data": [
    {
        "installed": 1, 
        "basic_info": 1, 
        "public_profile": 1, 
        "email": 1, 
        "read_insights": 1, 
        "manage_pages": 1, 
        "user_location": 1, 
        "user_friends": 1
    }],
    [ ... ]
}

Looks all right to me. I think manage_pages should be all I need?

Also, I can't find any official documentation about this and all posts about this are from 2011 or so. Has this function been removed maybe?

I am doing this on the server side (using PHP).

1

1 Answers

0
votes

Eventually, I found the problem: I need to use a page access token instead of a user access token.

It's mentioned in the API Reference here:

https://developers.facebook.com/docs/graph-api/reference/page/tabs/

Works fine now. manage_pages is the only permission I need.