I am writing an application that is supposed to push updates to a user's facebook wall/profile/etc. The user logs onto facebook, adds the app, and gives it permission to publish to her profile. That part works fine. The app runs as a Windows service, so
it has nothing to do directly with the user's session, cookies etc etc.
My code looks something like :
API api = new API();
api.ApplicationKey = "myappkey";
api.Secret = "mysecret";
// do all template / story building etc
// and this is where it dies
api.feed.publishUserAction(bundleID, templateData, ids, "Test story.", facebook.feed.PublishedStorySize.Short);
I get an "A session key is required for calling this method" error. Calling api.ConnectToFacebook() doesnt generate a session. I have seen suggestions elsewhere that one should derive from the IFrame or FBML form or windows controls and let those
handle the handshake. In my situation that's not possible because I am using neither, and I really need to manage all authentication myself using just the API class. For obvious reasons using Facebook connect is completely out of the question, as this process
must run autonomously after the user has given it consent to posting.
I also want to point out that with the instance of the API shown above, I can defintely connect to Facebook in "sessionless" mode, and easily request user info etc, so my app key and secret work fine. Things go wrong only when I try to do things
which require a session.