Unable to post on FB fanpage using SDK - facebook-graph-api

Exception occured, code: 200 with message: (#200) Permissions error I am able to post on users wall but not able to post on fanpage

Check this page: https://developers.facebook.com/docs/facebook-login/permissions/v2.2
Then scroll down to where it talks about Permissions That Require Review
Permissions That Require Review
Permissions that require review are generally reviewed within 3 business days. Some permissions may take up to 7 days to review, and are marked as such in the reference.
Extended profile properties. These permissions are all sensitive properties that may or may not be part of a person's public profile.
Extended permissions. These include the most sensitive pieces of profile information. One of the these permissions is publishing stories to a person's Facebook profile. All extended permissions appear on a separate screen during the login flow so a person can decide if they want to grant them.
Open Graph permissions. These permissions are for gaining access to any open graph data stored in someone's profile.
Page permission. This permission allows you to administer any Facebook Pages that the person manages.
I think that would fall under `Page permission' since a fan page is a page and not a user's wall.

Issue has been resolved..
I was using the user access token instead of page access token for posting on fanpage.
From here I generated the pageaccess token:
https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens

Related

How get publish_pages permission, to post on own business Facebook page using Graph API?

I am making a server-to-server Facebook 'app' so that some of the news articles we post to our own website can be posted on our own Facebook page too. I have read 14 squintillion pages of documentation, but cannot find how to get the publish_pages permission for myself or the app.
I have coaxed the app through the review process, and got the manage_pages permission allowed. I thought I had to submit all over again, to get publish_pages too, but the documentation says no. Apparently anyone appearing in the Roles for the app can grant the necessary permissions.
I have set myself up as admin for the app, yet when trying to get a token using the Facebook developer tools, I am never shown publish_pages. So even if I create a non-expiring token (my end goal) it is rejected with a message about the lack of publish_pages.
Shouldn't I be seeing more permissions listed here?
I'm sure I've read all relevant parts of the official documentation, plus StackOverflow answers and several unofficial walk-throughs, but I cannot work out what I am missing...
I thought I had to submit all over again, to get publish_pages too,
You do.
but the documentation says no. Apparently anyone appearing in the Roles for the app can grant the necessary permissions.
That is for apps in dev mode. Any of those users can grant the permission to your app, while it is in dev mode. But whatever you publish through your app, will only be visible to this group of users only, and not to the general public.
For the content to be visible to everyone, your app needs to be in live mode.
Before you can ask people - even those with a role in the app - for publish_pages when your app is in live mode, you need to submit that permission for review.

Auto post on friends wall when user logged in using Graph API for first time

When first time a user logged in through Facebook Graph API APP, whether any auto post will be triggered to others wall on user's behalf regarding new APP first Login?
APP is given permission to read_stream, publish_actions.
That is not allowed and not possible for many obvious reasons:
You are not allowed to autopost, not even on the wall of the authorized user. Every single post has to be approved by the user.
You are not allowed to prefill the message, it must be 100% user generated.
You can´t post to the wall of friends (anymore), that would be spam anyway.
...also, you will not get read_stream approved, but you would not need that permission for posting anyway:
This permission is granted to apps building a Facebook-branded client on platforms where Facebook is not already available. For example, Android and iOS apps will not be approved for this permission. In addition, Web, Desktop, in-car and TV apps will not be granted this permission.
Source: https://developers.facebook.com/docs/facebook-login/permissions/v2.2#reference-read_stream
Don´t create spammy Apps. User friends don´t care if the user just started using your App. You may want to read this too: https://developers.facebook.com/docs/apps/faq#invite_to_app

Find out if you can post to users wall

I'm currently toying with the Facebook Graph Api and have been able to get some interesting results, I would like to be able to post to one of my Facebook App users pages. They have authenticated the app and confirmed the ability for my app to be able to post on there wall. I know there is the can_post check using FQL, but I haven't seen any information on this using the Graph API. Is there a possible check to make so I can see if I have the ability to post on there wall?
can_post
https://developers.facebook.com/docs/reference/fql/user/
This settings is actually a setting of the timeline:
This setting only affects the viewers of the specific timeline and does not apply to the owner of the timeline.
can_post - bool - Whether or not the viewer can post to the user's Wall
Beyond this settings, by authenticating an application and giving it certain publishing permissions, the application, using it's per-user per-app access token will be able to perform actions on behalf the actual user. Actions will be attributed to the user even though it is the application that initiated and published these stories.
To answer what I assume is your underlying question - your application, given the appropriate permissions, will always be able able to publish a story to the users timeline. The act of giving an application any permissions is the same as allowing the application to act as you and access everything you would be able to access. This includes posting a story to your own timeline (even if no other user would be able to).

Posting photos to a Facebook page as a non-admin

A client wants the ability for people to upload photos from within their website and have them post to their Facebook page. I'm personally an admin of the Facebook page in question, so I can post the photo myself without issue. However, I'm trying to determine if there is a way for a non-admin to post a photo to an album within the page.
Originally, there was an offline_access scope which would allow me to get a single access token (logged in as myself) to be used on the third party website, but this is no longer the case. It's looking more and more like there is no way to write any kind of information to a Facebook page (including wall even wall posts) via the open graph api unless you're an admin and have a manage_pages enabled token.
Any thoughts?
You shouldn't need manage_pages permission. You want publish_stream.
manage_pages just allows you to obtain an access token to "log in as" an admin to a page the user has access to. Publish stream allows you to make comments and post on people's wall.
With publish_stream, you should be able to post pictures to the pages wall as long as that page's permissions allow you to do so. You won't be able to upload them to the pages album though, as that needs to be performed by an admin to the page. Just like your friends can post pictures to your wall, but they can't add photos to your albums.
Using the graph protocol, you can perform any action that both:
The user you're authenticated as has permission to perform
Your application has been granted permission to perform on the user's behalf.
So it's important to understand both the permission settings of both the actor (authenticated user) and the victim (the object being changed).

Is it possible to get access token for multi Facebook user?

I created web application using Facebook C# SDK 5.3.2. I can post messages to my wall. But I want to collect access tokens for my friends' Facebook accounts and store them to use later to post messages to their wall.
Is it possible to get their access token with their Facebook account info. I can get access token for myself with "App ID" and "App Secret. Do I need also add application for my friends' Facebook to get this credentials.
You don't need to store access_token for any user, since it's something time based.
Instead ask for publish_stream permission and post messages to their wall using application access_token
From Facebook documentation on publish_stream permission:
Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends. With this permission, you can publish content to a user's feed at any time, without requiring offline_access. However, please note that Facebook recommends a user-initiated sharing model.
the only way to get it done, is that your friends login into your application with their accounts and grant you the publish permission (if you want to publish when they are online) and the offline_access permission, to publish in any moment.
You have to think in the big security issue that this situation potentially represents.
Good luck.