【发布时间】:2013-09-19 17:47:38
【问题描述】:
我一直在为某些事情而苦苦挣扎,但我似乎错过了一些东西。我想使用我的 Facebook appid / appsecret 将活动发布到 Facebook。这些事件应该归应用程序所有,而不是任何用户。我尝试这样做:
var fc = new FacebookClient();
fc.AppId = "myappid";
fc.AppSecret = "myappsecret";
//get a token
dynamic result = fc.Get("oauth/access_token", new
{
client_id = fc.AppId,
client_secret = fc.AppSecret,
grant_type = "client_credentials"
});
//use the token to post to FB?
fc = new FacebookClient(token);
JsonObject json = new JsonObject();
json.Add("name", HtmlUtils.StripHtmlTags(@event.Title));
json.Add("description", HtmlUtils.StripHtmlTags(@event.Description));
json.Add("start_time", @event.StartDate.ToString("yyyy-MM-dd HH:mm"));
json.Add("no_feed_story","true");
//here i get an error
var id = fc.post("/myappid/events",json);
(OAuthException - #1) 发生未知错误。
我做错了什么?我的应用也没有处于沙盒模式。
【问题讨论】:
标签: c# facebook facebook-graph-api facebook-c#-sdk