我想通过facebook4j库从facebook获取数据,但我收到了此错误
必须使用活动访问令牌来查询有关的信息 当前用户。代码 - 2500
代码:
ConfigurationBuilder confBuilder = new ConfigurationBuilder();
confBuilder.setDebugEnabled(true);
confBuilder.setOAuthAppId("MY ID APP");
confBuilder.setOAuthAppSecret("MY APP SECRET");
confBuilder.setUseSSL(true);
confBuilder.setJSONStoreEnabled(true);
Configuration configuration = confBuilder.build();
FacebookFactory facebookFactory = new FacebookFactory(configuration );
Facebook facebookClient = facebookFactory.getInstance();
AccessToken accessToken = null;
OAuthSupport oAuthSupport = new OAuthAuthorization(configuration );
accessToken = oAuthSupport.getOAuthAppAccessToken();
facebookClient.setOAuthAccessToken(accessToken);
ResponseList<Post> feeds = facebookClient.getHome(new Reading().limit(1000));
答案 0 :(得分:0)
您可以选择自己创建并想要访问的应用。
.setOAuthAccessToken(“用户访问令牌”)
accessToken = oAuthSupport.getOAuthAccessToken(); // NOT AppAccessToken !!!
然后它应该工作