if (!IsPostBack)
{
var auth = new CanvasAuthorizer(fb);
if (!auth.IsAuthorized())
{
var url = auth.GetLoginUrl(new HttpRequestWrapper(Request));
var content = CanvasUrlBuilder.GetCanvasRedirectHtml(url);
Response.ContentType = "text/html";
Response.Write(content);
Response.End();
return;
}
dynamic me = fb.Api("/me");
if (fb != null)
{
FacebookID = fb.Session.UserId;
AccessToken = fb.Session.AccessToken;
}
FacebookApp fbapp = new FacebookApp(AccessToken);
dynamic videos = fbapp.Fql("SELECT vid, owner FROM video WHERE owner IN (SELECT uid2 FROM friend WHERE uid1 = me())");
foreach (dynamic v in videos)
{
// Can't return videos here
}
}
但是当我执行这个fql时没有视频。
但是使用上面的代码,我使用另一个fql,例如:
dynamic fanpages = fbapp.Fql("SELECT page_id, name, pic_big, type, page_url FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid=me() or uid in (SELECT uid2 FROM friend WHERE uid1=me()))");
foreach (dynamic fan in fanpages)
{
// Can return fan page in here
}
我认为问题是AccessToken。这个AccessToken在fql视频表时不能拥有权限,但在fql粉丝页面时可以拥有权限。
任何人请帮助我。
非常感谢。