Facebook Graph API搜索问题 [英] Facebook Graph API Search Issue

查看:54
本文介绍了Facebook Graph API搜索问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个使用图形API的搜索栏,直到大约一个月前它都可以正常工作.您可以在搜索栏中输入一些内容,然后从Facebook获取与您的搜索参数相关的信息.由于某种原因,它停止了工作.所以我去了浏览器搜索栏,像这样手动输入图形搜索-

I created a search bar that uses the graph API and it worked fine until about a month ago. You could type something into the search bar, and get info back from Facebook related to your search parameter. It stopped working for some reason. So I went to my browsers search bar to type in a graph search manually like this-

http://graph.facebook.com/search?q=zombies

这也不再起作用,并且我收到一条错误消息,指出此内容-

This doesn't work anymore either and I get an error message that says this-

{ 错误": { "message":(#200)必须具有有效的access_token才能访问此端点", "type":"OAuthException", 代码":200 } }

{ "error": { "message": "(#200) Must have a valid access_token to access this endpoint", "type": "OAuthException", "code": 200 } }

是否有使我的搜索停止工作的更新?我一直在阅读Facebook的文档,但找不到我想要的东西.有人可以帮助我重新进行此工作吗?我的搜索位于 http://ericnaff.com/html5/p3 .这是我正在使用的脚本-

Was there an update that made my search stop working? I've been reading Facebook's documentation and I can't find what I'm looking for. Can someone help me get this working again? My search is located at http://ericnaff.com/html5/p3. Here's my script that I am using-

功能searchFB(userSearchparameter){

function searchFB(userSearchparameter) {

$.getJSON('https://graph.facebook.com/search?q=' + userSearchparameter + '&type=post&callback=?', function(fbResults){
    $.each(fbResults.data, function() {
        // Data Templating
        $('<article class="fbResults"></article>').append ( 

            '<section class="resultsSource"><h6 class="shareHeader">' +
            '<img class="fromUser" src="https://graph.facebook.com/' + this.from.id + '/picture" height="50" width="50" alt="' + this.from.name + '">' +
            '<a href="http://www.facebook.com/' + this.from.id + '" class="fromName">' + this.from.name +'</a> shared a <a class="typeLink" href="' + this.link + '">' + this.  
            type + '</a> </h6>' +
            '<time class="createdTime" datetime="' + this.created_time + '">' + fuzzyFacebookTime(this.created_time.replace(/-/g,'/')) + ' &middot;</time>' +
            '<img class="typeLinkIcon" src="' + this.icon + '" alt="icon"></section>' +
            '<section class="resultsDescription"><h6><a class="shareLink" href="' + this.link + '">' +
            '<img class="sharePicture" src="' + this.picture + '" height="90" width="90" alt="' + this.from.id + '">' +
            '<span class="shareName">' + this.name + '</span>' +
            '<span class="shareCaption">' + this.caption + '</span>' +
            '<span class="shareDescription">' + this.message + '</span>' +
            '</a></h6></section>' +
            '<iframe class="linkShare" src="http://facebook.com/plugins/like.php?href=' + this.link + '"></iframe>'
        ).appendTo('body');

我知道它说我的错误中没有正确的访问令牌,但是它从来没有使用过,并且运行良好.如果需要添加一个,我要在哪里添加呢?谢谢!

I know it says I don't have the correct access token in my error, but it never used one in the first place and worked fine. If I need to add one, where would I want to include that? Thanks!

推荐答案

您将需要访问令牌;这意味着[已注册的Facebook应用] [1]

You will need an access token; this means an [registered Facebook App][1]

Facebook API更改13年7月10日:

图形API搜索更改

Graph API search changes

应用访问令牌. 不再支持搜索应用程序.

App access tokens will be required for all search Graph API calls except Places and Pages. Search for application will no longer be supported.

  1. 创建一个Facebook开发者帐户
  2. 创建一个新的Facebook应用
  3. 获取 https://graph.facebook. com/oauth/access_token?client_id = APP_ID& client_secret = APP_SECRET& grant_type = client_credentials
  4. 将返回的access_token = ...追加到您的搜索请求中
  1. Create an Facebook developer account
  2. Create a new Facebook App
  3. GET https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials
  4. Append the returned access_token=... to your search requests

这篇关于Facebook Graph API搜索问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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