Facebook Realtime API 中的验证令牌是什么
我正在尝试使用我的应用程序实现 Facebook Realtime api。我想从我的“Facebook 页面”中提取提要。 我已经获得了 app_access_token...
app_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
url = 'https://graph.facebook.com/' + FB_CLIENT_ID + '/subscriptions?access_token=' + app_access_token
url_params = {'access_token':app_access_token,'object':'page', 'fields':'feed', 'callback_url':'http://127.0.0.1:8000/fb_notifications/', 'verify_token' : 'I am taking a random string here...'}
urlResponse = call_url(url, url_params)
每次我使用 url 参数调用 url 时,都会收到错误:HTTP 错误 400: 错误请求 但是如果我调用没有 url 参数的 url,我会得到 {"data": []}
请注意,在 url 参数中,我使用 verify_token,一个随机字符串,而 callback_url 与facebook应用程序的redirect_url参数。(只是想知道是否有必要在这里输入相同的url?)
请告诉我我做错了什么? 我使用 python/django 来实现。
I'm trying to implement Facebook Realtime api with my application. I want to pull the feeds from my 'facebook PAGE'.
I've obtained app_access_token...
app_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
url = 'https://graph.facebook.com/' + FB_CLIENT_ID + '/subscriptions?access_token=' + app_access_token
url_params = {'access_token':app_access_token,'object':'page', 'fields':'feed', 'callback_url':'http://127.0.0.1:8000/fb_notifications/', 'verify_token' : 'I am taking a random string here...'}
urlResponse = call_url(url, url_params)
Everytime I call the url with url parameters, I get error : HTTP Error 400: Bad Request
But If I call the url without url parameters, I get {"data": []}
Please note that in url parameters, I'm taking verify_token, a random string and callback_url is not same as the redirect_url parameter for the facebook application.(just wanna know is it necessary to put the same url here?)
Please tell me what I'm doing wrong?
I'm using python/django to implement.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 POST 而不是 GET,正文为空
object
、fields
、callback_url
和verify_token
作为 url 中的查询参数传递。请参阅https://developers.facebook.com/docs/reference/api/realtime/< /a>.
Use POST rather than GET, with an empty body &
object
,fields
,callback_url
andverify_token
passed as query parameters in the url.See https://developers.facebook.com/docs/reference/api/realtime/.
我已经弄清楚了这一点...
。
。
。
。
向 url 发出 POST 请求:
将 {} 作为 post 参数传递......
确保 your_callback_url 应可访问。它不会在本地主机上工作(我想是这样......我无法在本地主机上测试它。)
所以在Python中代码应该是:
urlResponse应该为null。
附有callback_url的函数应该返回:
如有任何疑问,请告诉我!
要了解如何处理来自 FB 的通知:
请访问以下网址:
成功订阅后处理来自 Facebook 的通知请求
I've figured this out...
.
.
.
.
Make a POST request to url :
Pass {} as post parameters.....
Make sure that your_callback_url should be reachable. It will not work on localhost(I guess so... I was not able test it on localhost.)
So in Python the code should be :
urlResponse should be null.
Function attached with callback_url should return:
Please let me know in case of any doubts!!!
To know how to handle notifications from the FB:
Kindly visit the following URL:
Handling notifications request from Facebook after successful subscription