0

I followed these instructions and some others to create an app and get tokens: facebook: permanent Page Access Token?

I used the following php code to post using the app:

<?php
require_once 'src/Facebook/autoload.php'; $fb = new \Facebook\Facebook([ 'app_id' => 'apkey', 'app_secret' => 'appsecret', 'default_graph_version' => 'v2.10', //'default_access_token' => '{access-token}', // optional ]);

$linkData = [

"message" => "Wonderful message.",
]; $pageAccessToken ='pageaccesstoken';

try { $response = $fb->post('/targetfeed/feed', $linkData, $pageAccessToken); } catch(Facebook\Exceptions\FacebookResponseException $e) { echo 'Graph returned an error: '.$e->getMessage(); exit; } catch(Facebook\Exceptions\FacebookSDKException $e) { echo 'Facebook SDK returned an error: '.$e->getMessage(); exit; } $graphNode = $response->getGraphNode();

?>

I replace the keys and specific data with description.

My issue is that when I run this script it posts to the feed, but it posts as the app owner. I created the app in my personal account, and went through the token process using that account. I was granted admin access to the account that I want to post to, but when I post to that account it is posting as my person page and I instead want it to post as if I am posting as the account that I am posting to.

I am sure it some access token setting or permissions things, but I cannot figure it out. Any suggestions?

user999684
  • 705
  • 2
  • 10
  • 23
  • use the /me/feed endpoint with a user token of that specific user then – andyrandy Nov 15 '17 at 15:14
  • _“but when I post to that account it is posting as my person page”_ - you mean as your user profile, and that means you did not actually use a page token for your request. – CBroe Nov 16 '17 at 10:26

0 Answers0