我正试图张贴在Facebook页面的墙上。我可以使用App Access令牌在用户墙上发布。
I am trying to post on the wall of a facebook page. I am able to post on the user wall using App Access token.
我通过扩展DefaultFacebookClient
I got the App Access Token through extending the DefaultFacebookClient
public class ConnectionService extends DefaultFacebookClient{ public ConnectionService(String appId, String appSecret) { AccessToken accessToken = this.obtainAppAccessToken(appId, appSecret); this.accessToken = accessToken.getAccessToken(); } }有了这个,我可以发布到用户墙使用appID和appSecret。但是,当我试图发布用户没有授权应用程序执行此操作的页面错误获取错误
With this I am able to post to user wall using the appID and appSecret. But when I tried to post to Page Wall i get error of " The user hasn't authorized the application to perform this action"
任何人都可以建议? / p>
Anyone can advice?
推荐答案应用访问令牌是最基本的,不允许您发布任何内容。为了向Facebook页面(作为页面)发布某些内容,您需要获取页面访问令牌。
The App Access Token is the most basic one, and will not allow you to post anything. In order to post something to a Facebook Page (as a Page), you need to get a Page Access Token.
该过程有点复杂,因为您实际需要要授权用户首先使用manage_pages权限,使用用户访问令牌,您可以调用API获取页面访问令牌(/ me / accounts)。
The process is a bit complicated, because you actually need to authorize the user with the "manage_pages" permission first, with the User Access Token you can call the API to get a Page Access Token (/me/accounts).
看到这些链接:
- developers.facebook/docs/facebook-login/
- developers.facebook/docs/facebook-login/access-tokens/
- www.devils-heaven/facebook-access-tokens/
- developers.facebook/docs/facebook-login/
- developers.facebook/docs/facebook-login/access-tokens/
- www.devils-heaven/facebook-access-tokens/
Btw,REST API已弃用: https:// dev elopers.facebook/blog/post/616/
Btw, the REST API is deprecated: developers.facebook/blog/post/616/
您还可以尝试客户端令牌(开发人员设置>高级),我从来没有工作与那个,但它可能是最简单的解决方案。无论如何,App Access Token是错误的。
You can also try the "Client Token" (Developer Settings > Advanced), i never worked with that one but it could be the easiest solution. In any case, an App Access Token is the wrong one.
更多推荐
使用RestFB api发布到Facebook页面墙
发布评论