因此,SDK/Facebook 知道何时通过您传递给 Perms 设置的内容来请求用户允许做某事。如果您需要发布到那里的提要,请像这样将权限“publish_stream”添加到 CanvasAuthorizer。
var auth = new CanvasAuthorizer { Perms = "user_about_me,publish_stream" };
然后只是检查用户是否授权该访问。
if (auth.Authorize())
{
var client = new FacebookClient(auth.Session.AccessToken);
dynamic parameters = new ExpandoObject();
parameters.message = "Test App Message";
parameters.link = "http://www.example.com/article.html";
parameters.picture = "http://www.example.com/article-thumbnail.jpg";
parameters.name = "Test App Article Title";
parameters.caption = "Test App Caption for the link";
parameters.description = "Test App Longer description of the link";
parameters.actions = new
{
name = "View on Zombo",
link = "http://www.zombo.com",
};
dynamic result = client.Post("me/feed", parameters);
}else
{
//code what to do if the user does not give you publish Perms
}