I am attempting to publish a like for a page from my Titanium Alloy application.
var fb = require('facebook');
fb.appid = "1234567890";
fb.permissions = ['public_profile', 'email', 'publish_actions'];
fb.addEventListener('login', function(e) {
if (e.success) {
Ti.API.info('LOGIN : Logged In');
} else if (e.error) {
Ti.API.info('LOGIN : ' + e.error);
} else if (e.cancelled) {
Ti.API.info('LOGIN : Canceled');
}
publishLike();
});
function publishLike() {
var dict = {
access_token : fb.getAccessToken()
};
fb.requestWithGraphPath('/' + 'somePageId' + '/likes', dict, 'POST', function(e) {
if (e.success) {
Ti.API.info('publishLike : Success!');
} else {
if (e.error) {
Ti.API.info('publishLike : ' + e.error);
} else {
Ti.API.info('publishLike : Unkown result');
}
}
});
}
However, I encountered an error when the app made the API call:
[ERROR] : FacebookModule: (Thread-1559) [9475,21411] Request error for '/somePageId/likes' call: (#3) Application does not have the capability to make this API call.
[ERROR] : FacebookModule: com.facebook.android.FacebookError: (#3) Application does not have the capability to make this API call.
[ERROR] : FacebookModule: at com.facebook.android.Util.parseJson(Util.java:303)
[ERROR] : FacebookModule: at facebook.TiRequestListener.onComplete(TiRequestListener.java:88)
[ERROR] : FacebookModule: at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:276)
[INFO] : publishLike : (#3) Application does not have the capability to make this API call.
Any suggestions on how to successfully publish a like?