Unable to post on a Facebook page using Graph API - facebook-graph-api

I'm trying to post on my page using Facebook Graph API.
I added pages_manage_posts successfully and generated an access token, then made a POST request
https://graph.facebook.com/{page_id}/feed?message=Hello&access_token={page_access_token} but it always returns following error.
{
"error": {
"message": "(#200) If posting to a group, requires app being installed in the group, and \
either publish_to_groups permission with user token, or both pages_read_engagement \
and pages_manage_posts permission with page token; If posting to a page, \
requires both pages_read_engagement and pages_manage_posts as an admin with \
sufficient administrative permission",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AsKMEdaa8OGp1DX8uK8QRP-"
}
}
What I'm doing wrong?

Related

Application does not have permission for this action error: while publishing Instagram images

Using the below Facebook graph api to create a container for image upload:
curl --location --request POST 'https://graph.facebook.com/v14.0/17841453770969737/media?image_url=https://example.com/wp-content/uploads/2018/12/Images-without-copyright.png&caption=test1&access_token=EAAGYnCHTsQYBADhBYjYf9hjuixJZBUMXZBwrf5Hu9RFSc4uyV2VZBVdTLZAZAF1MG7VgAZCdBrP4ZBsNxMMYA7JRuoTgeUnPo4twHoPEmJhzoJpnYsTi1ZByTXW8kMVJCtfpZC7DDvgiZAlQaaaK3ZBy0NOfqXqwtNsAfyUpDsz7wOMsAZDZD'
17841453770969737 is the ig-user-id
getting the below error:
{
"error": {
"message": "(#10) Application does not have permission for this action",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "AHGxC5Wplf6j1CKQmsIQcN5"
}
}

Google workspace ADMIN SDK Directory API returns 403

I am trying to access below API (in browser Try this API) and after entering valid group key, I am getting below error message:
API
https://developers.google.com/admin-sdk/directory/reference/rest/v1/members/list
RESPONSE
{
"error": {
"code": 403,
"message": "Not Authorized to access this resource/api",
"errors": [
{
"message": "Not Authorized to access this resource/api",
"domain": "global",
"reason": "forbidden"
}
]
}
}
Only domain admins have access to most methods of the Admin SDK
If you authenticate as a domain user without admin rights or a consumer (Gmail) user, you will get the Not Authorized to access this resource/api error when trying to use the members.list.
Same applies to most other methods of the Admin SDK with the excepption of the ones that return only publicly accessable information.

User has insufficient privileges on the page on facebook even if login through admin

{ "error": {
"message": "(#10) User has insufficient privileges on the page.",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "GoRNu/X/zoq" } }
You ask for permissions with the scope parameter. It is a comma separated list of permissions. Visit the below url to get more information.
https://developers.facebook.com/docs/facebook-login/web#login
https://developers.facebook.com/docs/facebook-login/permissions

Can't access Facebook campaigns

I'm unable to get a list of my campaigns using Facebook Graph API
Response for /me/adaccounts
{
"data": [
{
"account_id": "123456789000001234",
"id": "act_123456789000001234"
}
],
"paging": {
"cursors": {
"before": "AAAAaaaBBBBcccc",
"after": "AAAAaaaBBBBdddd"
}
}
}
/123456789000001234/campaigns returns
{
"error": {
"message": "Unsupported get request. Object with ID '123456789000001234' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"fbtrace_id": "EilRrOk1CEb"
}
}
Note that id's have been changed to dummy-values.
The token is for a system user and the ad account have been assigned to the user (role: admin). Token contains following scopes: read_page_mailboxes, rsvp_event, ads_management, ads_read, read_insights, manage_pages, publish_pages, pages_show_list, pages_manage_cta, pages_manage_instant_articles, business_management, publish_actions
What am I doing wrong?
Had to use id: act_123456789000001234 instead of account_id: 123456789000001234 so the request becomes /act_123456789000001234/campaigns. Also had to create a Facebook App, add Marketing API and assign to that an Ad Account, then create a token via the app instead of creating a token from the Business Manager.

Invalid input: domain clientuserinfo is not present

As per the google documentation we ended up creating a service account (since there’s no user intervention and it’s middleware invoking the google api) and associating with the google admin api; We’re able to get a token back which we’re sending to the google api but here’s the response we’re seeing:
GET https://www.googleapis.com/admin/directory/v1/customer/my_customer /devices/chromeos?access_token=y000000000898999(mock token digits)
Response: {
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Input: Domain ClientUserInfo is not present"
}
],
"code": 400,
"message": "Invalid Input: Domain ClientUserInfo is not present"
}
}
Any ideas? My thought is that it’s to do with the my_customer as the id.
Using my_customer as the id should work but in this case, since the service account is not related to a domain, you are getting the error.
Admin SDK should be access by the admin of the domain. So in this case if you are using a service account, you should impersonate the domain admin account in order to make a valid call on his behalf.
You can also try this method from the documentation, accessing it as the admin of the domain.