Like facebook business page using built-in like open-graph api not working with javascript sdk -


Once the user is logged in and authorized to publish my app on their behalf, How do you like? Here is my code:

  window.fbAsyncInit = function () {FB.init ({appId: 'MY_APP_ID', position: true, cookie: true, xfbml: true, oauth: true} ); Document.getElementById ('fb-auth'). AddEventListener ('click', function) {FB.login (function) {if (response.authResponse) {// user authorized app FB.api ('/ me / likes / BUS_PAGE_ID', function (feedback) {If (user_likes 'user_likes'}} {} ({response.data.length & gt; 0} {// user liked page} other {// like page for user}}}}}}, {scope:} ;}, False); };   

This code is working at the point that it authorizes the app and I can see if the business page is preferred by the user with FB.api (...). If done (response.data .length> 0) What should I add to the place of the user like page of the user, so that my app can like a specific business page and add it to user preferences? Thank you.

The action can only be used for objects outside of Facebook.

You can not use the built-in action and you definitely can not like a user's Facebook page.

Use the user or redirect to your Facebook page.

Comments