为什么我从我的应用程序调用时从Graph api获取invalid_request?

时间:2015-04-06 14:02:37

标签: facebook facebook-graph-api dropwizard jersey-client

当我从浏览器发出以下请求时,它可以正常工作。

https://graph.facebook.com/app?access_token=<a valid token>

但是,从我的代码完成后,同样的调用失败并出现以下错误,对于在浏览器中工作的完全相同的令牌。

2 * Client out-bound request
2 > GET https://graph.facebook.com/app?access_token=<the fb token>
2 * Client in-bound response
2 < 400
2 < Content-Type: text/javascript; charset=UTF-8
2 < WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"
2 < Access-Control-Allow-Origin: *
2 < X-FB-Rev: 1674690
2 < Pragma: no-cache
2 < Cache-Control: no-store
2 < Facebook-API-Version: v1.0
2 < Expires: Sat, 01 Jan 2000 00:00:00 GMT
2 < X-FB-Debug: <some string>
2 < Date: Mon, 06 Apr 2015 13:46:57 GMT
2 < Connection: keep-alive
2 < Content-Length: 183
2 <
{"error":{"message":"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100}}

进行此调用的客户端代码是: -

ClientResponse r = httpClient.resource("https://graph.facebook.com/app")
        .queryParam("access_token", fbAccessToken).accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
FBAccessTokenResponse res = r.getEntity(FBAccessTokenResponse.class);
return res;

另一个有趣的事实是,如果fb令牌适合我(应用程序开发人员)或少数FB测试用户,则应用程序代码可以正常工作。对于其他实际用户,仅对我的应用程序失败并显示此错误。

0 个答案:

没有答案