Using Facebook\'s Graph API, I\'ve been successful at publishing to a user\'s feed while the user is offline with only the publish_stream permission. I don\'t need the offline_
The problem is you need to use the access token for the page provided via the premissions gained...
Uh... Easier way to say it is this:
Your app requested premission to "manage_pages" - once you accept/grant premission then you have an access_token for the apps premission (offline would just make expires=0 here)
So now your app has premission to manage your pages, but it needs the token for the specific page...
So if you issue a /me/accounts
(or /UID/accounts
) with the first token you will get a list of the pages the application has premission to access and their respective tokens...
From there just grab the token of the page and then issue your command with that token
Using the facebook class (facebook.php
and cert file)
require_once 'library/facebook.php';
$app_id = "YOURAPPID";
$app_secret = "YOURSECRET";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$token = array(
'access_token' => 'THE Token from app / manage_page auth'
);
$userdata = $facebook->api('/me/accounts', 'GET', $token);
echo ';
print_r($userdata);
echo '
';
You should see a llist of page id's and their access tokens...
Usuually i do a foreach $userdata['data']
and look for the page id, then i grab the token from that subarray...