什么是Facebook Realtime API中的验证令牌 [英] What is verify token in Facebook Realtime API

查看:90
本文介绍了什么是Facebook Realtime API中的验证令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用我的应用程序实现Facebook Realtime api.我想从"facebook PAGE"中提取提要. 我已经获得了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来实现.

解决方案

使用POST而不是GET,并且正文为空&在网址中作为查询参数传递的objectfieldscallback_urlverify_token.

请参见 https://developers.facebook.com/docs/reference/api/实时/.

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.

解决方案

Use POST rather than GET, with an empty body & object, fields, callback_url and verify_token passed as query parameters in the url.

See https://developers.facebook.com/docs/reference/api/realtime/.

这篇关于什么是Facebook Realtime API中的验证令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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