1
我使用下面的代碼(已發佈在Stackoverflow某處)發佈在Facebook的頁面牆上。發表在Facebook的牆上,無需登錄(C#)
它可以正常工作,但如果我沒有登錄,它會打開Facebook登錄窗口。 是否可以代表特定Facebook頁面的管理員帳戶執行代碼?
protected void Page_Load(object sender, EventArgs e)
{
string app_id = "123410186463705";
string app_secret = "1234ecd9bea862197372de656eb3d7b";
// using Facebook SDK for .NET
var fb = new FacebookClient();
dynamic result = fb.Get("oauth/access_token", new
{
client_id = app_id,
client_secret = app_secret,
grant_type = "client_credentials",
scope = "manage_pages,offline_access,publish_stream",
redirect_uri = Request.Url.AbsoluteUri
});
var app_token = result.access_token;
var client = new FacebookClient(app_token);
dynamic parameters = new ExpandoObject();
parameters.message = "Check out this funny article";
parameters.link = "http://www.natiska.com/article.html";
parameters.picture = "http://www.natiska.com/dav.png";
parameters.name = "Article Title";
parameters.caption = "Caption for the link";
//446533181408238 is my fan page
client.Post("/446533181408238/feed", parameters);
}
檢查在這裏:http://stackoverflow.com/questions/17426018/generate-never-expire-access-token-for-facebook-page –
不知道...但上面的代碼是大約2歲,它可能無法正常工作了。 –