【发布时间】:2011-06-11 16:41:41
【问题描述】:
我正在尝试在我的网站上提供一个工具,允许用户为他们的预订创建 Facebook 事件。
http://developers.facebook.com/docs/reference/api/event/
现在我正在做正确的过程:
1) 首先获得用户的授权 https://graph.facebook.com/oauth/authorize?client_id=APP_ID&redirect_uri=http://urlimredirectingto.comtype=web_server
2) 使用步骤 1 中返回的“代码”请求访问令牌 https://graph.facebook.com/oauth/access_token
3) 使用 access_token 创建事件 ...
string facebookCreateUri = string.Format("https://graph.facebook.com/{0}/events", loggedInMember.FacebookUID);
var formData = new HttpUrlEncodedForm()
{
{"access_token", accessToken},
{"owner", loggedInMember.FacebookUID},
{"description", "nice event that should be on the owners wall"},
{"name", "event on the users wall"},
{"start_time", "1272718027"},
{"end_time", "1272718027"},
{"location", "rochester"},
{"privacy","OPEN"}
};
HttpContent content = HttpContent.Create(formData);
HttpClient client = new HttpClient();
var response = client.Post(facebookCreateUri, "application/x-www-form-urlencoded", content);
但该活动发布在我的应用程序墙上,而不是用户的墙上。它不应该与 authentication/access_token 元素有任何关系,因为我使用相同的过程在用户的墙上发帖。 (http://developers.facebook.com/docs/reference/api/status/),效果很好。
【问题讨论】: