使用Restfb最新版本1.9.0获取OauthException

时间:2015-04-01 10:22:01

标签: java restfb

我们正在使用restfb最新版本1.9.0。迁移最新版本后,我无法使用公共搜索来获取帖子。

如何激活访问令牌。

  

>   必须使用活动访问令牌来查询信息

从github运行代码时出现以下错误

run-reader-examples:
     [java] * Fetching single objects *30 Mar, 2015 6:51:05 PM com.restfb.DefaultWebRequestor execute
     [java] 
     [java] FINE: Making a GET request to https://graph.facebook.com/me?access_token=517312558337191%7C5oHY9T3cZICO_TCeK8OdXKg5Y08&format=json
     [java] 30 Mar, 2015 6:51:09 PM com.restfb.DefaultWebRequestor execute
     [java] FINE: Facebook responded with HTTP status code 400 and response body: {"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}
     [java] Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: An active access token must be used to query information about the current user. (code 2500, subcode null)
     [java]     at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:1189)
     [java]     at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:1104)
     [java]     at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:1038)
     [java]     at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:951)
     [java]     at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:914)
     [java]     at com.restfb.DefaultFacebookClient.fetchObject(DefaultFacebookClient.java:415)
     [java]     at com.restfb.example.GraphReaderExample.fetchObject(GraphReaderExample.java:101)
     [java]     at com.restfb.example.GraphReaderExample.runEverything(GraphReaderExample.java:83)
     [java]     at com.restfb.example.GraphReaderExample.main(GraphReaderExample.java:75)
     [java] Java Result: 1

BUILD SUCCESSFUL

1 个答案:

答案 0 :(得分:1)

您无法使用应用访问令牌从/me端点获取信息。您需要用户或页面访问令牌。