Facebook 页面上发布的内容不可见?
Contents Posted on Facebook Page not visible?
我正在尝试使用 c# 和 Facebook SDK 在我的 Facebook 页面上 post。我可以 post 我的 Facebook 页面上的内容,但其他人无法正确看到它。即使是该页面的管理员也只能查看 post 的标题,但看不到 post 的图片或内容。但是页面的管理员可以通过单击 post 旁边的“>”这个标志来查看 post 的内容。请指导我为什么会这样,我该如何解决。
protected void Page_Load(object sender, EventArgs e)
{
CheckAuthorization();
}
private void CheckAuthorization()
{
string app_id = "My App ID";
string app_secret = "My App Secret";
string scope = "publish_stream, publish_actions";
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));
}
else
{
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"].ToString(),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"];
var client = new FacebookClient(access_token);
dynamic parameters = new ExpandoObject();
parameters.message = "Hello This Is My First Post To Facebook";
parameters.link = "http://www.google.com";
parameters.picture = "http://www.mywebsite.com/picture/welcome.jpg";
parameters.name = "Hello Users We welcome you all";
parameters.caption = "Posted By Ashish";
client.Post("/My Facebook Page ID/feed", parameters);
}
}
请指导我哪里做错了,因为我在几个网站上关注了某些 posts 后第一次尝试这个。
您正在使用 用户访问令牌 post 页面提要。因此,提要是代表用户(而不是页面)post编辑的,它们在时间轴上显示为摘要。
如果您 post 代表页面管理员本身的提要(以便 post 在时间轴上正常可见),您需要使用 页面访问令牌 具有 publish_actions
权限。
要获取您需要查询的页面访问令牌:/<page-id>?fields=access_token
使用具有 manage_pages
权限的普通用户令牌。
我只想补充一点,有时您的应用程序处于模式:开发人员,所以您所做的一切只有开发人员可以看到,这实际上是我遇到的问题,所以您需要转到您的应用程序仪表板并查找类似“Review”的内容 [我讨厌给出确切的路径,因为 Facebook 每隔一段时间就会更改所有内容],然后查找类似以下内容:您的应用程序正在开发中,public 不可用,将其放入 public
我正在尝试使用 c# 和 Facebook SDK 在我的 Facebook 页面上 post。我可以 post 我的 Facebook 页面上的内容,但其他人无法正确看到它。即使是该页面的管理员也只能查看 post 的标题,但看不到 post 的图片或内容。但是页面的管理员可以通过单击 post 旁边的“>”这个标志来查看 post 的内容。请指导我为什么会这样,我该如何解决。
protected void Page_Load(object sender, EventArgs e)
{
CheckAuthorization();
}
private void CheckAuthorization()
{
string app_id = "My App ID";
string app_secret = "My App Secret";
string scope = "publish_stream, publish_actions";
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));
}
else
{
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"].ToString(),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"];
var client = new FacebookClient(access_token);
dynamic parameters = new ExpandoObject();
parameters.message = "Hello This Is My First Post To Facebook";
parameters.link = "http://www.google.com";
parameters.picture = "http://www.mywebsite.com/picture/welcome.jpg";
parameters.name = "Hello Users We welcome you all";
parameters.caption = "Posted By Ashish";
client.Post("/My Facebook Page ID/feed", parameters);
}
}
请指导我哪里做错了,因为我在几个网站上关注了某些 posts 后第一次尝试这个。
您正在使用 用户访问令牌 post 页面提要。因此,提要是代表用户(而不是页面)post编辑的,它们在时间轴上显示为摘要。
如果您 post 代表页面管理员本身的提要(以便 post 在时间轴上正常可见),您需要使用 页面访问令牌 具有 publish_actions
权限。
要获取您需要查询的页面访问令牌:/<page-id>?fields=access_token
使用具有 manage_pages
权限的普通用户令牌。
我只想补充一点,有时您的应用程序处于模式:开发人员,所以您所做的一切只有开发人员可以看到,这实际上是我遇到的问题,所以您需要转到您的应用程序仪表板并查找类似“Review”的内容 [我讨厌给出确切的路径,因为 Facebook 每隔一段时间就会更改所有内容],然后查找类似以下内容:您的应用程序正在开发中,public 不可用,将其放入 public