【发布时间】:2012-02-01 19:04:47
【问题描述】:
我正在开发一个简单的 java 程序来自动发布(文章)到我的 facebook 有趣页面。我创建了一个应用程序并使用 url 获得了 access_token:https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=APP_ID&client_secret=CLIENR_SECRET。我使用这个 java 代码发布到有趣的页面墙上:
String url = "https://graph.facebook.com/" + PAGE_ID + "/feed"
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("access_token", accessToken));
nvps.add(new BasicNameValuePair("message", item.getTitle()));
HttpClient client = new DefaultHttpClient(params);
HttpPost httpost = new HttpPost(url);
httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
HttpResponse response = client.execute(httpost);
HttpEntity entity = response.getEntity();
我收到了这个错误:
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException"
}
}
如何授权我的应用发布到我的趣味页面? 提前致谢
遵循
的推荐【问题讨论】:
-
这里是类似的讨论,将照片发布到 Facebook 而不是文章。stackoverflow.com/questions/4474367/…
标签: java facebook access-token