our web application posts messages to Facebook wall of logged user. We are using the Facebook Graph API. This feature did work in the past. When trying it today, I am getting an error message and cannot figure out where the problem is.
I am testing it with my Facebook account and I did not reject any permission.
When the user wants to connect his / her FB account with our web app, the app redirects to
https://www.facebook.com/dialog/oauth/?client_id=our_ID&redirect_uri=our_URI&state=generated_string&scope=email,publish_actions&response_type=code
Later, when the app calls
https://graph.facebook.com/me/permissions?access_token=some_token
it receives response
{
"data":[
{
"permission":"email",
"status":"granted"
},
{
"permission":"public_profile",
"status":"granted"
},
{
"permission":"installed",
"status":"granted"
}
]
}
The permission publish_actions is missing.
When the app POSTs to
https://graph.facebook.com/me/feed?access_token=some_token
with parameter
message=somemessage
the following error response is returned
{
"error":
{
"message":"(#200) The user hasn't authorized the application to perform this action",
"type":"OAuthException",
"code":200,
"fbtrace_id":"FDM+n+5S14V"
}
}
Why is the permission to post on wall suddenly not granted?
Thanks for help.
Related
I'm facing to a strange issue with Facebook Graph API: for a given Facebook Page, the API does not always retrieved the Instagram Business ID associated.
My client have his page "WonderfulClientPage" which he is owner and admin.
He invited me to be administrator of his page. So, both of our Facebook accounts have the MANAGE role.
When he trying to get his Instagram Business ID from the Graph API through our Facebook App, it does not working: the API replying without the ID. The API response:
{
"id": "100[...]966"
}
But, when I'm doing the same with my account, it's working fine:
{
"instagram_business_account": {
"id": "178[...]519"
},
"id": "100[...]966"
}
When tried to do it with another account, freshly invited as an administrator: it's working !
It seems it's mandatory to be a "recent" administrator of a page to retrieved the Instagram Business ID ... It's look liker weird.
The HTTP request:
GET https://graph.facebook.com/v11.0/100[...]966?access_token=EAAGqeRDgkT8BAF[...]WMc90asIcZD&fields=instagram_business_account
Data from Token Debug (https://developers.facebook.com/tools/debug/accesstoken/):
Type: User
Valid: True
Origin: Web
Scopes: email, read_insights, pages_show_list, ads_management, business_management, instagram_basic, instagram_manage_insights, instagram_content_publish, pages_read_engagement, pages_manage_posts, public_profile
Does someone had the same issue ? Is there something else I'm missing to explain that ?
I spent whole days to try to figure out this error, I also notice there are similar questions with the same message, but I'm totally not sure I find the answer in there, so if someone could point out or give any tip into my problem, I totally appreciate that.
I'm making the request to send a message from a Facebook page A to a user X (by userId) who makes a comment on a post of FB Page A, through a testing FB App name MyApp. I am trying this on Facebook Graph Explorer.
I got the user Id by fetch the list of comments in a post in the Facebook Page, but I totally could not send the message.
Here is the error
{
"error": {
"message": "(#100) No matching user found",
"type": "OAuthException",
"code": 100,
"error_subcode": 2018001,
"fbtrace_id": "H3yMO0RWaDy"
}
}
Here is the my track
MyApp has been setup webhook OK, because it is not published yet for the testing purpose (unapproved app), so I have to add the user X account into tester pool of MyApp (the message that I try to send is also this user X)
I logged into user X to make a comment on a post in the FB Page A
On Graph Explorer, I selected Application: MyApp, and get Page Access Token of FB Page A, I performed two following requests
3.1 /{page_id}_{post_id}?fields=comments
With this, I can get the list of existing comments in FB Page A, here is the output:
{
"comments": {
"data": [
{
"created_time": "...",
"from": {
"name": "User X",
"id": "123456789" // this is the user Id that I would take to send the message to
},
"message": "Sample comment from User X",
"id": "..." // {page_id}_{post_id}
}
],
"paging": {
....
}
},
"id": "..." // {page_id}_{post_id
}
}
3.2 {page_id}/messages: I am trying to send a message from FB Page A to user X with the user Id that I got from 3.1 step
recipient: {id: "123456789"} // there seems be a problem with this id that I got from step 3.1, FB cannot find the user id with this number
message: {text: "hello"}
I'm also acknowledged about the app/page scoped id for user.
I have already subscribed MyApp to the FB Page A with API (/{page_id}/subscribed_apps)
Facebook API v2.10
I have no clue what's wrong.
I figured it out. Facebook Messenger Platform use paged scope user id, but what I were using is app scope id. They are different.
Here is official doc from Facebook about how to get the paged scope id
The id must be an ID that was retrieved through the Messenger entry
points or through the Messenger webhooks (e.g., a person may discover
your business in Messenger and start a conversation from there.
These IDs are page-scoped IDs (PSID). This means that the IDs are
unique for a given page.
If you have an existing Facebook Login integration, user IDs are
app-scoped and will not work with the Messenger platform.
The solution is subscribing MyApp to the FB Page (what I've already done) to get the webhook to work, where I will get the page scope id from the message of user.
Furthermore, detail of how to setup the subscription found here
http://ukimiawz.github.io/facebook/2015/08/12/webhook-facebook-subscriptions/
I want automatically post to my own facebook page as page not user after user creates article on my website.
First of all: it is possible to do that without user authorization?
I already tried:
FB.api(
"/page_id/feed",
"POST",
{
'access_token': pageAccessToken,
"message": "This is a test message"
},
function (response) {
console.log(response);
}
);
But got error that user not authorized.. Maybe there is way to work around and automatically post to my own facebook page?
In order to get this message
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException",
"code": 200
}
}
That would mean you didn't grant publish_actions permissions for the session user.
You need user authorisation at some point in the process then you extend the user token. See https://developers.facebook.com/docs/roadmap/completed-changes/offline-access-removal#extend_token
Once you have an extended token get the page token, and that token will have no expiry.
Ref: https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed
A page access token with publish_actions permission can be used to publish new posts on behalf of that page.
I'm trying to post to a facebook page (as the page and as the admin user with each one access token) with just a parameter 'message'.
I've the same error in php and in Graph API Explorer in both cases:
{
"error": {
"message": "(#1) An unknown error occurred",
"type": "OAuthException",
"code": 1,
"error_data": {
"kError": 1455002
}
}
}
The same post to the API adding a paremeter link or just link without message works fine.
The user has granted those permissions: create_note, email, manage_pages, photo_upload, publish_actions, publish_stream, share_item, status_update, user_friends, video_upload.
The app is in Sandbox Mode and the user is a test user, not a real one.
I'm able to write to user feed and to create custom actions for him.
I've verified both, the page access token and the user access token with Access Token Debugger.
I've already reviewed a lot of questions in stackoverflow, tutorials and blog posts.
What am I missing?
UPDATED: I can't either post a link in page with app access token.
I am developping my first facebook social game in PHP and I follow the social game tutorial provided on developer.facebook.com
My game is on a server and loaded into a canvas page.
Everything is clear but I can't resolve a problem when I try to deal with achievements: http://developers.facebook.com/docs/guides/games/getting-started/#step6
I was able to create, register and save achievements but I get an error when I try to consult the achievements my user had already earned. The code is this one:
function getAchievements() {
FB.api('/me/achievements', function(response) {
for(var i = 0; i < response.data.length; i++) {
...
}
...
});
In my console, if I trace the response object, I see there is an authentication error:
response : {
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
}
}
I've tried a lot of things but I can't resolve this problem.
The user is logged, I've asked for email,publish_actions permissions, I've tried to add the user_games_activity extended permission... :(
Does someone know what is going on with this particular FB.api call?