facebook Fan Page管理员怎么样?

时间:2016-10-16 08:52:48

标签: c# facebook post admin

**我可以做安装,但以我自己为代表,facebook的管理员发送不共享。可能是什么问题呢? Asp.net我正在使用facebook sdk

管理员如何访问粉丝专页

protected void Page_Load(object sender, EventArgs e)
{
    if (Request["Code"] == null)
    {
       Response.Redirect(string.Format("https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}", app_id, Request.Url.AbsoluteUri, scope)); 
    }
}

private void CheckAuthorization()
{
    Dictionary<string, string> tokens = new Dictionary<string, string>();

    string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}", app_id, Request.Url.AbsoluteUri, scope, Request["Code"], app_secret);

    HttpWebRequest request = System.Net.WebRequest.Create(url) as HttpWebRequest;

    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
    {
        StreamReader reader = new StreamReader(response.GetResponseStream());

        string vals = reader.ReadToEnd();

        foreach (string token in vals.Split('&'))
        {
            tokens.Add(token.Substring(0, token.IndexOf("=")), token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
        }
    }

    string access_token = tokens["access_token"];

    dynamic messagePost = new ExpandoObject();
    messagePost.access_token = access_token;
    messagePost.picture = "picture";
    messagePost.link = "link";
    messagePost.name = "name";
    messagePost.caption = "caption";
    messagePost.description = "description ";

    FacebookClient app = new FacebookClient(access_token);
    app.Post("/PAGE ID/feed", messagePost);
}

1 个答案:

答案 0 :(得分:0)

https://developers.facebook.com/docs/pages/getting-started#get_token https://developers.facebook.com/docs/pages/publishing

正如文档所说,你需要有特殊的页面标记

  1. 您的申请必须有&#39; manage_pages&#39;对您的用户的权限
  2. 获取页面令牌(不是您的用户令牌!)

    GET https://graph.facebook.com/{page-id}?fields=access_token

  3. 此外,您还可以显示所有页面,当前用户可以管理的内容。

    GET https://graph.facebook.com/v2.8/me/accounts?access_token=#{user_token}

  4. 会返回类似的内容:

    {
      "data": [
        {
          "access_token": "EAACEdEose0cBACZBQs59Xjr....",
          "category": "Community",
          "name": "xxx",
          "id": "111",
          "perms": [
            "ADMINISTER",
            "EDIT_PROFILE",
            "BASIC_ADMIN"
          ]
        },
        {
          "access_token": "EAACEdEose0cBAPRKAgY.....FOr",
          "category": "Magazine",
          "name": "xxx",
          "id": "111",
          "perms": [    
            "CREATE_CONTENT",
            "MODERATE_CONTENT",
          ]
        },