如何使用Python / Django获取(和使用)Facebook的扩展权限 [英] How to get (and use) extended permissions in Facebook with Python/Django

查看:121
本文介绍了如何使用Python / Django获取(和使用)Facebook的扩展权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个简单的应用程序,让用户授予我的代码许可来写入她的页面的Facebook流。据我了解,它应该很简单:

I'm trying to write a simple app that lets a user grant my code permission to write to her page's Facebook stream. As I understand it, it should be as easy as:


  1. 让用户点击一个按钮,启动一个包含一个页面的弹出窗口我的Facebook应用程序。

  2. 在该页面中,他们点击了 stream_publish 到我的应用程序,并将该权限分配给他们的页面。

  3. 窗口关闭,我现在拥有在cron中运行脚本的所有信息到那个页面的流。

  1. Have the user click on a button that launches a popup containing the a page in my Facebook app.
  2. In that page, they click on something that grants stream_publish to my app and assigns that permission to their page.
  3. Window closes, I now have all the info I need to run a script in cron to push stuff to that page's stream.

我一直在阅读维基数天。关于 pyfacebook 的注意事项至少已经过了一年,人们有指出了我的 socialauth 应用程序,Django似乎同样过时,并专注于定位用户而不是其页面。我不能做#1在那里,沿#2和3.

I've been reading the wiki for days. Notes on pyfacebook are at least a year out of date, and people have pointed me to the socialauth app for Django which appears to be equally out of date and focused on targeting users as opposed to their pages. I can't even do #1 up there, let along #2 and 3.

如果有人可以告诉我如何使用Django / Python来请求/接受权限写一个Facebook流,这将是一个伟大的开始。

If someone could show me how to use Django/Python to request/receive permission to write to a Facebook stream, that would be a great start.

任何帮助将不胜感激。

推荐答案

经过很多的修补,我似乎已经解决了我在Facebookland的所有问题:

After a lot of tinkering, I appear to have solved all of my problems in Facebookland:


  1. 原来,有一个用户点击按钮来授予权限就像CaioRomão所说的一样简单。对于我来说,我发现将他们引导到Facebook桌面应用程序链接更容易,更可靠。

  2. 使用此链接方法,Facebook允许您指定 enable_profile_selector = 1 ,这将确保生成一个页面列表,用户可以从中选择哪些页面(如果有的话)将授予这些权限。

  3. 这个,但是,Facebook完全被打破了。而在#2中,他们允许用户选择一个页面来授予权限,他们不会通过POST或标题将这些信息传递到应用程序。只是不在那里相反,你必须使用FQL做一个丑陋的技巧,并向用户提出一些额外的问题才能使其工作。

  1. Turns out that having a user click on a button to grant permissions is as easy as Caio Romão said it was. For my part though, I found that directing them to the Facebook Desktop App link was way easier and more dependable.
  2. Using this link method, Facebook allows you to specify enable_profile_selector=1 which will make sure that a list of pages is generated from which the user can select which pages (if any) will grant these permissions.
  3. For this one though, Facebook is totally broken. While in #2 they allow the user to select a page to grant permissions, they don't pass this information onto the application either by way of a POST or in the headers. It's just not there. Instead, you have to do an ugly trick with FQL and some additional questions to the user to make it work.

无论如何, a href =https://danielquinn.org/blog/facebook-page-syncronisation/ =nofollow noreferrer>详细说明我的博客,如果有人有兴趣。感谢您的帮助!

Anyway, I detailed it all on my blog if anyone is interested. Thanks for your help!

这篇关于如何使用Python / Django获取(和使用)Facebook的扩展权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆