1

I have a PHP app which interacts with facebook. I'm successfully able to post a photo to user wall , uswer timeline and to the wall of a facebook page, but when i try to post the same photo to facebook page timeline it throws an error "invalid appsecret_proof parameter". i commented out the code that tries to set the appsecret_proof in base_facebook.php file and then tried running the app it gave "The user hasn't authorized the application to perform this action" error. i have given 'photo_upload , publish_stream , publish_actions , manage_pages , user_photos' permissions to the app . i have set the access token of the page before making the following call

$ret_obj = $facebook->api ( '/page_id/feed' , 'POST' , array(  
                                                'source'  => $photo ,
                                                'message' => $message ,
                                                'name' => 'vinay' ,
        ) );

how do i resolve this?

edit : i have also disabled the "Require AppSecret Proof for Server API calls" in the app advanced settings

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
vinayhudli
  • 99
  • 8
  • 1
    Photos are to be posted against `page_id/photos`, not `page_id/feed` [according to docs](https://developers.facebook.com/docs/reference/api/page/#photos). – CBroe Oct 23 '13 at 15:33
  • using page_id/photos i'm able to post to page's timeline, how do i post to page album or to the news feed such that the photo appears in page's home. – vinayhudli Oct 23 '13 at 15:56
  • 1
    By posting against `/album_id/photos` …? https://developers.facebook.com/docs/reference/api/album/#photos – CBroe Oct 23 '13 at 16:01
  • yes, but shouldn't page_id/photos do the same thing as album_id/photos, according to facebook doc if no album id is specified app should create an album and post the photos to the album – vinayhudli Oct 24 '13 at 03:35
  • CBroe just answered to your ques: `how do i post to page album`. – Sahil Mittal Oct 25 '13 at 05:59

1 Answers1

1

If you want to post to a specific album, use /album_id/photos and if you don't care of any album simply use: /page_id/photos.

Now, if you use the user access token, the photo will be uploaded on that page (in either of the above two cases), but it will appear in the page wall under the section:

Recent Posts by Others on PageName

If you want your photo to be visible on the page's timeline; the photo must be published on behalf of the page itself- using the page access token, not the user access token.

To get the page access token query for: /me/accounts with permission: manage_pages. Demo

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
  • ya i have tried uploading the photo using page access token (mentioned in the question) that's what leading me to invalid appsecret_proof parameter error – vinayhudli Oct 25 '13 at 06:24
  • Have you checked out this dicussion: http://stackoverflow.com/questions/18683421/why-do-i-get-invalid-appsecret-proof-provided-in-the-api-argument ? – Sahil Mittal Oct 25 '13 at 06:28
  • But you said that you are able to publish photo using `page_id/photos` in your second comment? – Sahil Mittal Oct 25 '13 at 06:30
  • yes i have checked the http://stackoverflow.com/questions/18683421/why-do-i-get-invalid-appsecret-proof-provided-in-the-api-argument . – vinayhudli Oct 25 '13 at 06:40
  • ok let me just summarise : i'm able to upload to user timeline , user album , page timeline : all these using the user access token , what is left to be done is posting (if possible) to page album so that it appears on page's home – vinayhudli Oct 25 '13 at 06:44
  • that means the page access token is not used correctly, use the page token with your call itself, like other parameter `'access_token' => 'PAGE_ACCESS_TOKEN'` and try out your call with [Graph API Explorer](https://developers.facebook.com/tools/explorer) – Sahil Mittal Oct 25 '13 at 06:48