0
votes

All, I've got a page that I'm an admin for on Facebook and I've also got an application for the page. I'm trying to allow my application to post offline messages to my wall for I can't figure out how to give my application the permissions needed in order to do that. I did find the following URL:

https://www.facebook.com/dialog/oauth?client_id=$id&client_secret=$secret&redirect_uri=$uri&scope=publish_stream,offline_access,read_stream,manage_pages&response_type=token

Can I just put this directly into my browser? I updated the ID and the secret but I'm also not sure what to put into the uri? Does this give me a permanaent token that I can always use?

Any help you can give me is greatly appreciated.

Thanks!

1

1 Answers

3
votes

You will need to get an application access token to post as an application. You will need to query Graph API's me/accounts and find the app in that list. You will also see a different access token assigned to that app. You then can use that token to post as that app.

See also: Post to Facebook application page as APPLICATION user Remember pages and apps are in the same category under the me/accounts

$result = $facebook->api("/me/accounts");
foreach($result["data"] as $page) {
    if($page["id"] == $page_id) {
        $page_access_token = $page["access_token"];
        break;
    }
}
$args = array(
    'access_token'  => $page_access_token,
    'message'       => "I'm a Page!"
);
$post_id = $facebook->api("/$page_id/feed","post",$args);