Issue with Facebook JS API for comments due to permissions error, despite having the necessary authorizations

I've been trying to use the FB JS API to POST a comment.

FB.api("/" + myFBPageId + "/comments", "post", {
  "fb:explicitly_share": true
  "message": contents
}, function(response) { console.log(response) })

Despite having both publish_actions and publish_stream permissions, I keep encountering this exception:

"message":"(#200) Permissions error","type":"OAuthException","code":200

Why is this happening? I have confirmed that I am authenticated with Facebook on my site by running this test:

FB.login(function(response) {
  console.log(response);
}, {scope: 'publish_stream'});

So my question is, what is causing the permissions error and how can I resolve it?

Answer №1

I am trying to submit a comment

Just providing the page id is not enough. How will Facebook know which feed to comment on? You need to give Facebook the feed-id instead of just the page where you want to post a comment. Here is the correct syntax if you want to post a comment on a feed:

/POST_ID/comments, rather than /PAGE_ID/comments


And, if you are looking to post a feed instead of a comment, you should use-

/PAGE_ID/feed

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

Error: Unable to iterate over JSON data as json.forEach is not a valid function

let schoolData = { "name": "naam", "schools" : [ "silver stone" , "woodlands stone" , "patthar" ], "class" : 12 } schoolJSON = JSON.stringify(sc ...

Can you please explain how to separate a collection of emails that have various formats using JavaScript?

My list of emails contains two formats: with name name <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="395c5458505579585d5d4b5c4a4a175a5654">[email protected]</a>> without name <a href="/cdn-cgi/l/email-prote ...

Identify the failing test cases externally using JavaScript

I am currently tackling an issue where I am seeking to identify the specific test cases that fail when running a test suite for any javascript/node.js application. Finding a programmatic solution is crucial for this task. Mocha testsuite output result Fo ...

Navigating the world of getElementById and addEventListener outside of the DOM

Having some dynamic HTML code in my JS, I'm hoping to assign an ID to a particular tag: content: ` <p id="openKeyboard"> If the click happens, I want to trigger an event. </p> ` However, upon ...

Avoid the issue of markers clustering in Leaflet to have distinct markerClusterGroup icons without overlap

Is there a way to prevent two separate markerClusterGroups from overlapping in Leaflet? I have one with a custom Icon to differentiate between the two clusters, but for simplicity's sake, I've omitted that part in this example. var map = L.map(&q ...

Navigate to the correct page when the Button is clicked in a ReactJS/Django project

Embarking on my web development journey, I opted for django/Reactjs to build a social network platform. I created several API methods like account/view_user/ to retrieve a list of users and account/view_user/ for specific user attributes. In React, I cra ...

Is there a way to determine if an array contains multiple occurrences of unidentified strings?

Is there a way in JavaScript to determine if an array contains two or more identical values? For instance; ['one','two','three'] -> false, because no items in the array are repeated. ['one','one',&apo ...

Using ng-if in AngularJS to compare two objects

I am transferring between controllers with different formations, and I am attempting to use "ng if" to compare the ids, but it is not functioning as expected. Below is the code snippet: var postsApi = 'http://mywebsite.com/wp-json/posts?filter[p ...

Dynamic cell loading in Vue using Vuetify's datatable functionality

<template> <v-data-table :headers="headers" :items="records" :items-per-page="5" show-select loading item-key="id" class="elevation-1" > <template v-slot:top> <div> <table-tabs> ...

Angular 6: encountering difficulty in setting up component routes (from root to child) when creating separate modules

As a newcomer to Angular, I'm encountering some difficulties in defining child routes in Angular. I'm not sure where I'm going wrong. When I try to create a separate module for the child components, I run into issues when defining the routes ...

Determine the specific cell involved in an HTML5 drag-and-drop interaction within a table

I've been experimenting with the HTML5 drag and drop functionality in an Angular project. Here's the setup I'm working with: A container containing draggable 'objects' A table where users can drop the dragged elements Following ...

Encountering error while trying to set up Hardhat using npm - "npm ERROR! Invalid URL code"

PS C:\Users\jawad\OneDrive\Desktop\NFT Project> npm install --save-dev hardhat npm ERR! code ERR_INVALID_URL npm ERR! Invalid URL npm ERR! A complete log of this run can be found in: C:\Users\jawad\AppData\L ...

Unable to make changes to the recently inserted rows

I'm having trouble editing newly added rows in my table. I've assigned a class to the newly added row, but when I click the edit button, nothing happens. Furthermore, once I do manage to edit a row, the edit button stops working altogether. It se ...

What is the best way to render JSON information in JSP with JavaScript?

Using Spring MVC, my controller "Book.java" returns a JSON object. I would like to display the content of the JSON object in a table format in a JSP. How can I achieve this? Here is the function in my controller that returns the JSON object: @Controller ...

Encountering build:web failure within npm script due to TypeScript

Our project is utilizing the expo-cli as a local dependency in order to execute build:web from an npm script without requiring the global installation of expo-cli. However, when we run npm run build:web, we encounter the following exception. To isolate th ...

Guidelines for submitting and displaying content on a single page with jQuery and MySQL

Objective: To develop a Q&A Script using PHP, JavaScript, and jQuery that allows users to post questions and provide answers. Upon submitting a new answer, it should be stored in the database and automatically displayed in the answers section. Challenge: ...

unable to use redirect feature for specific URLs with nodejs module

I have been using the request nodejs module to retrieve HTML content from websites. However, I have encountered issues with certain redirection websites, as shown below: var request = require('request'); var options = { url: "http://www.amw ...

Does this Loop run synchronously?

Recently, I crafted this Loop to iterate through data retrieved from my CouchDB database. I am curious whether this Loop operates synchronously or if async/await is necessary for proper execution. database.view('test', 'getAllowedTracker&ap ...

How can I adjust the time in a range slider using AngularJS?

Currently, I am utilizing a Slider with draggable range in angular js for time selection. The Slider can be found here: https://jsfiddle.net/ValentinH/954eve2L/. I aim to configure the time on this slider to span from 00.00 to 24.00, with a 10-minute inter ...

What issues are present in the Ajax script and the PHP radio input?

I'm having trouble extracting the value of a radio input in this code so I can update the database: <script type="text/javascript> function getVote() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlh ...