Facebook API For Wall Post -
i trying post on facebook wall through fb api
, getting error in console.
error object { message="(#200) user hasn't a... perform action", type="oauthexception", code=200} code 200 message "(#200) user hasn't authorized application perform action" type :"oauthexception"
i trying way.
<div id="fb-root"></div> <script type="text/javascript"> (function() { var e = document.createelement('script'); // replacing older version until fb fixes cancel-login bug e.src = document.location.protocol + '//connect.facebook.net/en_us/all.js'; //e.src = 'scripts/all.js'; e.async = true; document.getelementbyid('fb-root').appendchild(e); }()); window.fbasyncinit = function() { fb.init({ appid : 'xxxxxxxxxxxxxxxxxxx', status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true , // parse xfbml oauth : true // enable oauth authentication }); }; function post_on_wall() { fb.login(function(response) { if (response.authresponse) { alert('logged in!'); // post message wall var opts = { message : document.getelementbyid('fb_message').value, name : 'post title', link : 'xxxxxxxxxxxxxxxx', description : 'post description nanital', picture : 'imagelink' }; fb.api('/me/feed', 'post', opts, function(response) { if (!response || response.error) { alert('posting error occured'); } else { alert('success - post id: ' + response.id); } }); } else { alert('not logged in'); } }, { scope : 'publish_stream' }); } </script>
note: working fine, if loggedin same id through create app. not working other facebook user.
first of all, publish_stream
deprecated since years. need publish_actions
:
a user access token publish_actions permission can used publish new posts
source: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/feed
that being said, need go through review process publish_actions
before can use every other user: https://developers.facebook.com/docs/apps/review/login
Comments
Post a Comment