Mok*_*dre 4 java facebook access-token
我正在开发一个简单的java程序,自动发布(文章)到我的Facebook有趣的页面.我创建了一个应用程序并使用url获得了access_token:https://graph.facebook.com/oauth/access_token?grad_type = client_credentials & client_id = APP_ID & client_secret = CTRIENR_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();
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException"
}
}
Run Code Online (Sandbox Code Playgroud)
如何将我的应用授权发布到我的有趣页面?提前致谢
以下推荐
DMC*_*MCS 15
哇,我看到同样的问题每天至少要问一次.
你会想要manage_pages和publish_stream.一旦页面管理员进行身份验证,就me/accounts从该列表中查询并获取该页面的访问令牌.使用该页面的访问令牌,您可以发布到me/feed.
| 归档时间: |
|
| 查看次数: |
24998 次 |
| 最近记录: |