Javascript – Facebook post to the Page Wall without publish_stream permission

facebookjavascriptPHP

I have a web app that allows people to register directly or by using their facebook credentials through the facebook registration plugin. I want to be able to duplicate information posted on the website to my website's facebook fan page. So far if I have a user that is not logged into facebook, it will post to my Page's wall no problem showing that it came from my website app. But if the person is logged into facebook, but has not granted my app the publish_stream permission I get a permissions error. Is there anyway to simply force the post to come from my website app if I don't have the proper permission with the user? I would be happy if every post on my facebook page came from the app and never from the user, but I simply can't find any documentation showing how this is done or if it even can be done.

EDIT

Here is the code I am using that will allow me to post to my own wall if the person is not logged into facebook. I have already authorized the app to post.

$attachment = array('message' => $notes,
                    'name' => 'Backcountryride.com',
                    'caption' => "Community Driven Transportation",
                    'link' => 'http://backcountryride.com',
                    'description' => $description,
                    'picture' => 'http://backcountryride.com/images/vanlogo.jpg'
                    );
    $result = $facebook->api('/backcountryride/feed/','post',$attachment);

EDIT2

Here is the code I use to instantiate the $facebook object:

$facebook = new Facebook(array(
  'appId'  => FACEBOOK_APP_ID,
  'secret' => FACEBOOK_SECRET,
  'cookie' => true,
));

$session = $facebook->getSession();

$me = null;
// Session based API call.
if ($session) {
  try {
    $uid = $facebook->getUser();
    $me = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
  }
}

Thank you!

Best Answer

What you are looking for is an "app login". You can get a session for your app instead of the user. Not easy to find, I stumbled across it a few weeks ago. Then you just use the functions you normally use, but with your "app" session instead of a "user" session.

https://developers.facebook.com/docs/authentication/#app-login

Related Topic