本文介绍了即使使用具有正确权限集的有效access_token,FacebookClient也不会获取给定相册ID的所有照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Facebook Graph API从给定的相册ID中获取所有照片.我尝试在Facebook Graph Reference网站上找到它,但是找不到任何帮助.所以这就是我在做什么.

Using Facebook Graph API, I am trying to get ALL of the photos from a given album ID. I tried finding it on Facebook Graph Reference site, but couldn't find any help. So here it is what I am doing.

我有一个有效的access token,并已获得user_photosfriend_photos的许可.我已经验证了该Facebook调试器站点.我已经有专辑ID.以下是我要传递的URL:

I have a valid access token with permission of user_photos and friend_photos. I already verified that facebook debugger site. I already have the album id. And following is my URL that I am passing:

https://graph.facebook.com/<albumId>/photos?access_token=<my-valid-access-token>

我确实得到4张照片,但我总共有29张照片.另外,我看不到上一个"或下一个"的任何光标.所以,现在,我迷路了.不知道我在这里想念的是什么.任何帮助表示赞赏.我正在使用适用于.NET的Facebook SDK.

I do get 4 photos, but I have 29 photos in total. Also, I don't see any cursor for "prev" or "next". So, now, I am lost. Don't know what I am missing here. Any help is appreciated. I am using Facebook SDK for .NET.

推荐答案

因此,以下是对我有用的解决方案:对于facebook选项,我已经将"user_photos"和"friend_photos"作为范围的一部分. "friend_photos"在这里并不重要.我必须将"user_checkins"添加到合并范围中,以获取给定相册中的所有照片.所以这就是我现在正在使用,并为我工作的东西.在我进行调查时, Graph API Explorer 对我很有帮助.

So, here is the solution that worked for me:For facebook options, I already had "user_photos" and "friend_photos" as part of the scope. "friend_photos" is not really relevant here. I had to ADD "user_checkins" to the scope collection to get all of the photos that I had in my given album. So here it is that I am using now, and getting things working for me. Graph API Explorer was super helpful for me when I was investigatiing this.

var facebookOptions = new Microsoft.Owin.Security.Facebook.FacebookAuthenticationOptions{...};
facebookOptions.Scope.Add("email");
facebookOptions.Scope.Add("user_about_me");
facebookOptions.Scope.Add("user_events");
facebookOptions.Scope.Add("user_groups");
facebookOptions.Scope.Add("user_likes");
facebookOptions.Scope.Add("user_photos");
facebookOptions.Scope.Add("user_videos");
facebookOptions.Scope.Add("user_checkins");
facebookOptions.Scope.Add("user_friends");
facebookOptions.Scope.Add("user_location");
facebookOptions.Scope.Add("user_photo_video_tags");
facebookOptions.Scope.Add("user_actions.music");
facebookOptions.Scope.Add("user_activities");
app.UseFacebookAuthentication(facebookOptions);

这篇关于即使使用具有正确权限集的有效access_token,FacebookClient也不会获取给定相册ID的所有照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 00:43