Facebook Requires extended permission: create_event - facebook

I have this app that create events on behalf of a page. All of a sudden the event creation stopped working, the Graph API giving the following error
403 Forbidden: {"error":{"message":"(#290) Requires extended permission: create_event","type":"OAuthException"}}
Has there been any recent changes that might have affected my app's functionality? Is there any way to request "create_event" permission as the page? Using for example FB.login() requires me to change back to my user.

Turns out that due to the Oauth2 change recently (probably), the permission on the old access token was gone (maybe should've thrown something like "invalid access_token" error instead...). Follow the instructions on https://developers.facebook.com/docs/authentication/ with the create_event permission in addition to manage_pages.

Related

Getting "(#100) Pages Public Content Access requires either app secret proof or an app token" issue when calling Facebook API?

I am developing an app that syncs with users Facebook account and fetches Facebook page information. Initially, app asks for Login with Facebook and gets page list. After getting pages I am calling API to get posts associated with each page. Once I get post details then I am calling insight APIs to get insights of each post.
This flow working fine with development mode but when I switch to Live mode I am getting the following error
Client error: `GET https://graph.facebook.com/v4.0/100575944711552/feed` resulted in a `400 Bad Request` response:{"error":{"message":"(#100) Pages Public Content Access requires either app secret proof or an app token","type":"OAuthE (truncated...)
{"userId":1,"email":"superuser#corals.io","exception":"[object] (GuzzleHttp\\Exception\\ClientException(code: 400): Client error: `GET https://graph.facebook.com/v4.0/100575944711552/feed` resulted in a `400 Bad Request` response:
{\"error\":{\"message\":\"(#100) Pages Public Content Access requires either app secret proof or an app token\",\"type\":\"OAuthE (truncated...)
From the details what I observed I am getting this error while using,
GET /v5.0/{page-id}/feed HTTP/1.1
Host: graph.facebook.com
this endpoint. I am currently having 2 permissions approved,
manage_pages 2. read_insights
and app review team rejected 2 permissions saying the request is invalid and for this use case we don't require this which are,
1.Page Mentions 2. user_posts
Can anyone help me to understand what is the exact issue?
I had the same problem. Upon reacting to their damn changes yet again (manage_pages is not a thing anymore). I only had pages_manage_metadata but not pages_read_engagement to actually read the content on the page... -.-
I also appear this error. for me, I found that since graph api v5.0, request has changed. The docs said:
Page Public Content Access
This change applies to v5.0+
Requests made to endpoints that require the Page Public Content Access feature must be made with either an App Access Token or include the app's App Secret. If the calling app has been granted the manage_pages permission however, an app access token or app secret is not required.
If you only retrieve public data. You can use requests by app access token quick fixed. But if you want to get more. You need to follow the docs update. :)
I have fixed this issue. Everything is fine but the only issue is when authenticating with facebook login I needed to include "manage_page" permission in scope section.

Facebook - Private Replies - read_page_mailboxes permission missing

I'm trying to call
/v2.9/{comment-id}/private_replies
(https://developers.facebook.com/docs/graph-api/reference/v2.9/object/private_replies) but always get the following error:
(#200) Requires read_page_mailboxes permission to manage the object
I'm using a test version of the app. The user submitting the comment is an administrator of the app. From my understanding, if the user is an administrator, the permissions wouldn't need to go through the review process just for testing/developing? read_page_mailboxes is not yet a confirmed permission for the app.
Any ideas what the problem could be?
Answering my own question: The problem in the end was that the access token didn't include the read_page_mailboxes permission. I had to manually create a page access token that includes it.
I initially created the token here: https://developers.facebook.com/apps/{APP-ID}/messenger/ but that doesn't seem to add the necessary permission.
See here on how to create a permanent page access token: https://stackoverflow.com/a/43570120/769726
The permission doesn't need to be approved by Facebook while you're still in development.

Cannot read Business Page messages with Facebook Graph API despite appropriate permissions

Last week I requested an app review with Facebook, which has successfully granted me permission to request "read_page_mailboxes" permission for users of my application.
I now have an extended access token which, according to the Graph Explorer tool has properties:
App {app_id}: SAM :. Thinkka
User {user id}: James Hartnoll
Valid: True Scopes read_page_mailboxes, manage_pages, publish_pages, business_management, public_profile
I am trying to read conversations of a business page, using this URL:
https://graph.facebook.com/v2.7/[Page_Id]/conversations?fields=can_reply,id,unread_count,updated_time,subject,snippet,link&access_token=[access_token]
However, when I make the request, the response is:
{
"error": {
"message": "(#298) Requires extended permission: read_mailbox",
"type": "OAuthException",
"code": 298,
"fbtrace_id": "FEHvo/6+z39"
}
}
Now according to the Facebook documentation, here:
https://developers.facebook.com/docs/graph-api/reference/v2.7/page/conversations
I have all the permissions I need (namely read_page_mailboxes).
I have done some research and this question (not mine) on Stack Overflow, sums up fairly well what I am doing.
One answer suggests to try using https://graph.facebook.com/v2.7/me/conversations.... but that results in the same error, and the other answer suggests that read_page_mailboxes need approving.
That permission has been approved though, see the start of this question!
The Facebook change log here: https://developers.facebook.com/docs/apps/changelog#v2_4
Tells me that read_mailbox is deprecated, and reading further into that permission, it seems it would not have been granted anyway according to the App Review request, that permission is not available for Web applications anyway.
So... I am stuck?! I have all the permissions that I am required to have according to the documentation, my token is valid and my "GET" requests are correct, but I need a permission which was deprecated a year ago?!
I've sent this message to Facebook too, but it'll take a few days for them to reply and it's irritating me as this should work apparently!
Anyone here had any experience/solution with this?
**NOTE: ** I am after Business Page messages, NOT, personal ones - for clarity.
You're not using page access token to request,instead you're using user access token.You need to first get page access token via GET /me/accounts or visit getting page access token for more details on that.
Once You have this token you can read page conversation by using the following method in PHP:
$pagemessages = file_get_contents('https://graph.facebook.com/me/conversations?access_token={page-access-token}');
var_dump($pagemessages);
or simply using GET request to above link.
Thanks!

Unable to post to facebook page using app token

I am building my first facebook app and am facing a issue.
Task : Build a entirely server side application to be used by the admin of a facebook page to post videos/photos on the page. This should not involve having the admin to log in everytime to generate the user acess and page access token.
What I found : Based on the requirement, I found that app tokens can be used for this purpose. This line specifically hints at the usefulness.
App access tokens can also be used to publish content to Facebook on behalf of a person who has granted an open graph publishing permission to your application
I think that using this will be safe since mine is an entirely server side app.
Problem The docs say that:
GET /oauth/access_token?
client_id={app-id}
&client_secret={app-secret}
&grant_type=client_credentials
will give the app token that can be used in place of user access token.
However, I have not been able to do so. Specifically the error encountered is
Error 200 .The user must have accepted the TOS. Since I have already tried publishing content with page access token, I know this is a permission issue.
The following line
a person who has granted an open graph publishing permission to your application.
does not clarify everything. I came across a related question, but the answers seem to be a bit vague.
It would be really great if someone could give me insights about how this can be achieved.
In order to post to a page, you need at least authorize with the manage_pages permission. If you want to post "as user", you need to add publish_actions and use a "User Access Token". If you want to post "as page", you need to add publish_pages and use a "Page Access Token".
Information about how to generate those Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
The error message with the TOS has been discussed a lot of times already, please go to those threads (or find a lot more with the search function):
(OAuthException) (#200) User must have accepted TOS on C# - Facebook
How come I get a "must have accepted TOS" error for test users with app installed?
facebook long term token "(#200) User must have accepted TOS"
Occassional (OAuthException - #200) (#200) User must have accepted TOS
You cannot post to a Page via an App Access Token. This is clearly stated in the docs at
https://developers.facebook.com/docs/graph-api/reference/v2.3/page/feed#publish
A user access token with publish_actions permission can be used to publish new posts on behalf of that person. Posts will appear in the voice of the user.
A page access token with publish_pages permission can be used to publish new posts on behalf of that page. Posts will appear in the voice of the page.
I'd recommend to use a eternal Page Acess Token, so there's no obligation to renew the User Access Token. Have a look at my answer here:
Post to a facebook page without "manage_pages" permission using php
See
https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens

Cannot get Facebook ads_management extended permission

I'm trying to get statistics on my facebook ad campaigns. I've followed Facebook own guide, and I've created an app and so on. However I'm unable to get ads_management permission. If I use the Graph Explorer and its "Get Access Token", I cannot select ads_management under extended permissions, the option is simply not there.
I've also tried just sending a request to the Facebook api as follows:
https://www.facebook.com/v2.0/dialog/oauth?client_id=MY_CLIENT_ID&redirect_uri=MY-REDIRECT_URI&scope=ads_management&response_type=token";
Which does get me a access token, but not one with ads_management permission
Any thoughts?
Edit: My app is not whitelisted, but unless I've misunderstood the guide, it does not have to be, as long as I'm a developer on the app, is this correct?
From what I understand of the Facebook Ads API guide is that the ads_management extended permission is only granted to whitelisted apps. So if the Graph endpoint you're hitting requires that permission then you'll have to get your app approved. Check out the getting started overview https://developers.facebook.com/docs/reference/ads-api/overview