I apologize if this has already been answered, but all the information out there on Facebook publishing is so confusing and conflicting, I haven't been able to get anything to work yet. I'm trying to set up an application that runs on my local server to publish content to my organization's fan page (this 开发者_开发百科will tie in with my WCMS to cross-post content). I believe I want a Facebook Connect application to do this which I've set up properly in Facebook and gotten an application key and secret. Here's the code I'm trying to execute, but each time it's run I get "User has not authorized access" even if I'm just trying to publish to the application wall.
ConnectSession fbSession = new ConnectSession("APP_KEY", "APP_SECRET");
Api fbAPI = new Api(fbSession);
fbAPI.Stream.Publish("hello world");
I've also tried:
fbAPI.Stream.Publish("hello world", null, null, FAN_PAGE_ID, APP_ID);
I've granted my application access to publish on the fan page.
EDIT:
I've tried turning this into a Desktop application instead because it appears as though Javascript needs to be involved in order for it to be a Connect application. Here's the updated session initialization line. This now gives me a "Incorrect signature error."
DesktopSession fbSession = new DesktopSession("APP_KEY", false);
There is a similar question titled "How can I post to a facebook wall from a c# web service?" for which I provided a very lengthy answer, specifically indicating how to post to a page.
casperOne's solution works, however, I found this article to be the best solution.
http://tech.karolzielinski.com/publish-post-of-facebook-page-wall-as-a-page-not-a-user-python-facebook-rest-api
This authorizes the application to post directly to the Fan Page without having to go through an admin account.
精彩评论