Button for liking posts on Facebook made of titanium

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?

Answer №1

As per the information provided in this response, it is not possible to like pages using the Graph API. This limitation exists because the API only allows liking Open Graph objects, and pages do not fall under this category of objects.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issuing a straightforward GET request results in a significant delay in receiving a response

I have a simple app running on Node.js, Handlebars, and Express. The main page features a single button that triggers an asynchronous GET request when clicked, causing a console.log message to display. Initially, the first click on the Submit button shows ...

I am having trouble inserting a table from a JSON object into an HTML file

getJSON('http://localhost:63322/logs', function(err, data) { if (err !== null) { alert('Something went wrong: ' + err); } else { //var myObj = JSON.parse(data); // document.getElementById("demo").innerHTML = myObj.ad_soy ...

What is the reason behind the lack of asynchronous functionality in the mongoose find method

Outdated code utilizing promises I have some legacy code implemented with mongoose that retrieves data from the database. The schema being accessed is AccountViewPermission. Everything works fine as I am using a .then, which essentially turns it into a Pr ...

What is the most efficient way to halt the pipe if the value of an HTML input element remains unchanged using RxJS?

I'm currently incorporating RxJS into my Angular 9 project. My goal is to bind a keyup event to an input field and trigger an HTTP request whenever the user types a new value. Here's the code snippet I have: fromEvent(this.inputBox.nativeElemen ...

It's time to wrap up the session with some old "cookies" and a closing function

Would like the message to only display once after clicking the "Cookies" button. Once the user accepts cookies, they should be stored on their device for a set period of time. Your assistance is greatly appreciated. :) Below is the html and js code: $(do ...

In an empty JavaScript MVVM Organization View, the ViewModel is packed with lines of code

I find myself always placing all of my code within the ViewModel because nothing else seems to fit. What kinds of things should be included in the view? Does anyone have any examples? ...

The `.append()` function includes HTML content as plain text

I am using JavaScript to dynamically add HTML elements to my webpages. I have created a loop that iterates through all the projects, each containing multiple pictures. The first step involves generating the project title and adding it within a div element ...

Unable to retrieve Vuex state within a function

Currently, I am developing a Laravel+Vue application where Vuex is used for state management. While working on form validation, everything seems to be progressing smoothly except for one particular issue that has me stuck. The problem arises when I attempt ...

Tips for including MUI icon within a list displayed on a map:

Initially, I brought in the AccountCircle Icon from MUI: import { AccountCircle } from '@mui/icons-material'; Then, I utilized styled to customize the icon: const UserIcon = styled(AccountCircle)({ margin: '0px 0px 0px 0px', }); My ex ...

Is it feasible to add on to an existing object in the database? (Using Node.js and Mongoose

After saving an object to the database using the following code: var newObject = new PObject({ value : 'before', id : 123456 }); newObject.save(function(err) { if (err) ...

You cannot define headers once they have been sent to the client. If you encounter a NextJS redirect issue, consider using res

I encountered an error when redirecting to a link from NextJS -> _app.js -> getInitialProps. I am trying to cache the last user language in cookies and redirect to it when the page is reloaded. It's working and the user is redirected, but I&apos ...

Pass information from an array of objects to a visual component

My objective is to display 3 instances of the SearchItem component from locations[0].results[0] and 3 instances from locations[0].results[1] I have an array containing objects with data that I want to display in my SearchItem component: const locations = ...

What steps should I take to address the issues with my quiz project?

I've been working on a new project that involves creating a quiz game. I came across some code online and decided to customize it for my needs. However, I'm encountering some issues with the functionality of the game. Right now, the questions ar ...

Tips for preventing the use of website URLs as variables in jQuery ajax() calls:

Having some trouble. For example: $(document).ready(function () { $("#btnSend").click(function () { var noti_p = { url: "Pusher_Controller.ashx", data: "&appname=" + $("#selt1").val() + "&title=" + $("#title"). ...

After the checkbox is clicked, I must send a boolean value to the function through the input flag in AngularJS

<input class="bx--toggle" id="toggle-view" type="checkbox" ng-model="vm.monthView" ng-change="vm.getRelevantData()" ng-attr-data-modal-target="{{vm.alertForSaveAll ? '#add-save-all-alert-modal': 'undefined'}}"> Within this p ...

What could be causing the Quasar drawer to overlap the Quasar toolbar in a Vue application?

I am currently utilizing the quasar UI framework and have a main layout file that includes only a toolbar. This toolbar is meant to display across all pages in my application. <template> <q-layout view="hHh Lpr lff" style="backgro ...

Creating a service function (constructor) in JavaScript

When working with AngularJs and calling a service method: app.service('nameService', function() { this.Service = function (){console.log('hello')} } You can then use this service (object) like so: nameService.Service() My question is, ...

Steps for populating a table with data from a JSON array

I am currently facing a challenge in populating an HTML table with data retrieved from a two-dimensional array. The information is being fetched through an $.ajax script after executing a php/MySQL query. Despite successfully parsing the data in the succes ...

Attempting to retrieve all elements... held within a parent object in JavaScript

Currently diving into JS, Jest testing, and React - quite the ride! { '1': { accountName: 'Dance Party', balance: 200, key: 1 }, '2': { accountName: 'Whiskey Party', balance: 69, key: 2 }, '3& ...

GUI interface for interactive three.js fragment shaders

I am currently experimenting with the three.js webGL shader example and am attempting to implement a GUI that can dynamically control the parameters of the shader in real time. Is this achievable? It appears that when I place the effectController variable ...