javascript - Can't Post to Facebook Page using JS -


okay want post facebook page page(this developing mode application viewable ne). have done facebook login.

so ask 2 permissions , are

  1. manage pages
  2. publish pages

i can post page using facebook graph explorer tool can't via javascript code.

here code write using js. code written inside function.

fb.api('me/accounts', function(response){       token = response.data[0].access_token;       post_with_token(token); });   function post_with_token(token){   var message = $('#post_body').html();   var page_id = 'page_id';    fb.api('page_id/feed', 'post',       { message : message,         access_token : token},        function (response){         console.log(response);         }); 

the error object in console says

message: "(#200) user hasn't authorized application perform action"

both apps , graph explorer have same permissions granted.is new permission asked. unable figure out problem is.correct me if wrong anywhere.

i got answer posted below didn't got why need additional permission.?

publish_pages has been introduced graph api version 2.3.

before that, publish_actions used allow posts on pages page – v2.3, have made 2 separate permissions. publish_actions publish as/in name of user, , publish_pages publishing page.

graph api explorer has api version 2.3 selected default – why call successful there. likely, own api call js code, did not use v2.3, specified lower api version when initializing js sdk.

so specify version: 'v2.3' in fb.init parameters (see basic setup section in js sdk docs), , should work fine publish_pages.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -