Facebook app posting to page successfully, but pos

2019-02-26 00:37发布

问题:

I have setup a facebook app to post images / videos to one particular fan page. It requests 'publish_actions' and 'manage_pages permissions. It is in developer mode and I have no intention to expand the functionality beyond posting to this single facebook page.

The code works correctly, it posts to the correct page and everything looks good whilst logged into the developer account / page admin (same account). But other facebook users cannot see the posts that have been made via the app. I was under the impression that apps didn't need to go through the review process for internal apps such as these?

Heres a quick stripped down version of the code for posting to the page:

FacebookSession::setDefaultApplication($settings['app_id'], $settings['secret']);
//This is user access_token not the pages.
$session = new FacebookSession( $settings['access_token'] );

$pageTokenResponse = (new FacebookRequest(
             $session
                , 'GET', '/' . $settings['page_id'] 
                , array( 'fields' => 'access_token' )
          ))->execute()->getGraphObject(GraphPage::className());

//Retrieved Page Token
$pageToken = $pageTokenResponse->getProperty("access_token");

uploadUrlToFacebook($imgurl, $item->get_title(), $session, $pageToken, $settings['page_id']);

function uploadUrlToFacebook($url, $title, $session, $pageToken, $pageId){
    $request = new FacebookRequest(
      $session,
      'POST',
      "/$pageId/photos",
      array (
          'access_token' => $pageToken
         ,'url' => $url
        ,'message' => $title
      )
    );
    $response = $request->execute();
}

I'm sure there is a stupid error either somewhere in the code or my apps setup but why can I see the posts but nobody else can ?

回答1:

Turns out I had already selected some items for review before I properly understood the process so I ended up in a state of not being able to make the app live as I had pending review items. I deleted the permissions from the review queue, made the app live and all is good.



回答2:

I think while authenticating Fb App you given "only me" visibility for Publish Actions.

go to https://www.facebook.com/settings?tab=applications

Select your App . Then Check this . "App visibility and post audience"