Facebook用户登录群组成员(Facebook login for group members)

编程入门 行业动态 更新时间:2024-10-27 08:33:47
Facebook用户登录群组成员(Facebook login for group members)

我是Facebook上的一个小组的管理员,它有大约40-50名成员。 现在我正在为该组织建立一个网页,授权使用Facebook登录的用户(如果有问题,我正在使用Laravel + SammyK的LaravelFacebookSDK )。

一切正常,但有一个问题。 我只想限制登录Facebook群组的成员。 最好的方法是使用/ me / groups API,但这需要user_groups权限,该权限受到限制。

当然,还有'hacky'解决方案,比如每个用户手动为App Insight用户创建一个脚本,或者编写一个脚本来更新我服务器上每天包含组成员列表的数据库中的数据库,但是并不是一种简单,优雅的方式去做这个?

我非常怀疑Facebook会允许我仅为此使用user_groups权限。

I'm the administrator of a small group on Facebook, it has about 40-50 members. Now I'm building a webpage for the group which will authorize users using Facebook Login (I'm using Laravel + SammyK's LaravelFacebookSDK if that matters).

Everything works fine, there is a problem though. I'd like to restrict login for only those who are members of the Facebook group. The best way would be using the /me/groups API, but that requires user_groups permission, which is restricted.

Of course there are 'hacky' solutions like making each user manually to an App Insight user or writing a script that updates a database on my server every day that contains the list of the group members, but isn't there a simple, elegant way to do this?

I highly doubt Facebook will allow me to use the user_groups permission just for this.

最满意答案

那么图形API确实提供了这个功能,如你所说,你只需要用户权限,而不是facebooks。 正如您可以传达此权限的需求和好处一样,您只需将它记下来,在接近注册/登录的地方。 然后您需要在scope变量中指定user_groups,即使用getLoginUrl方法发送。

$scope = ['email', 'user_status', 'user_groups']; // it is 'groups' or 'user_groups' $login_url = $fqb->auth()->getLoginUrl('http://my-callback/url', $scope);

我没有测试这个代码,因为我手头没有安装,但是从我刚才读的所有内容来看,这就是它应该如何工作的。

编辑:几乎忘了,你会使用下面的符号从你的Facebook对象中获取数据:

$groups = $fqb->object('me/groups')->get();

Looks like there is only one nice way to achieve this:

Although /me/groups requires user_groups permission to retrieve groups the user is a member of, it can return groups created by the app without it (given there is a valid access token of course).

So - while it's clearly not as nice and seamless as I wanted it to be - my solution was to create a new Facebook group using the app (requires only a POST request) and move current members to this new one.

Edit: moving members is not a possibility, joining an app group is only possible programatically using the SDK. Therefore, when a user is not a member of this group, I'll prompt them to join. It means that everybody can join and I have to manually ban those I don't like instead of manually allowing those I want to, but given the low publicity, I can deal with this.

更多推荐

本文发布于:2023-08-04 07:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413033.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户登录   群组   成员   Facebook   group

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!