PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, March 13, 2022

[FIXED] Facebook app posting to page successfully, but posts are not visible to non-developers. Do I really have to review for an app with 1 user?

 March 13, 2022     facebook, facebook-graph-api, facebook-php-sdk, php     No comments   

Issue

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 ?


Solution

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.



Answered By - Matthew Lawson
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing