问题
This is my very first try using this SDK, so be gentle with me. I did this:
var fbWebContext = FacebookWebContext.Current;
if (fbWebContext.IsAuthorized())
{
// post as application
var fb = new FacebookOAuthClient { AppId = "205378862824897", AppSecret = "4deb72e26c22415fe00e44028b401114" };
dynamic result = fb.GetApplicationAccessToken();
var appAccessToken = result.access_token;
Dictionary<string, object> parameters = new Dictionary<string, object>()
{
{"description", "Testbeskrivning"},
{"link", "http://zitac.se"},
{"name", "Testtitel" }
};
var fbApp = new FacebookWebClient(appAccessToken);
result = fbApp.Post(FB_ID_FANPAGE + "/feed", parameters);
lblMessage.Text = result;
}
And got his: (OAuthException) (#200) The user hasn't authorized the application to perform this act.
Is there some settings needed on the fan page?
This is using ASP.NEt 4.0 and SDK 5.0.7.
回答1:
The error "The user hasn't authorized the application.." sounds like the Facebook user does not have the necessary permissions, check here for details.
They would need as a minimum to have authorized 'publish_stream'.
Check the permissions you are asking for in the JavaScript on your page; the Facebook Javascript reference explains this in detail.
Hope this helps.
回答2:
Andy has it mostly, BUT there is something else here that I realized. It sounds like you want to post AS THE APP to the user's wall. If you are just wanting something to show up on the user's news feed then you need the user to like your app. And then when you post to the app's wall, it should show up on the user's feed (actually all user's news feed).
If you want a direct to the user's wall, then you need to post to "{facebook userid}\feed". Mind you Facebook may or may not allow this (I have forgotten whether they do or not at this moment).
From what I can tell what you have done so far should work. The problem you are having is that you are posting to an unknown fan page (Is the app authorized on that fan page?)
来源:https://stackoverflow.com/questions/5431544/how-to-post-as-application-to-facebook-wall-using-facebook-c-sharp-sdk