I have been using below code to get data from my facebook home using restFb api.
import java.util.List;
import com.restfb.Connection;
import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.FacebookClient.AccessToken;
import com.restfb.types.Post;
import com.restfb.types.User;
public class restFB_tester {
public static void main(String[] args) {
//60 days auth
String authToken="XXXXXXX";
FacebookClient fbClient = new DefaultFacebookClient(authToken);
Connection<Post> result=fbClient.fetchConnection("me/home",Post.class);
int counter =0;
for(List<Post> page :result)
{
for(Post aPost:page)
{
System.out.println(aPost.getMessage());
System.out.println("fb.com/"+aPost.getId());
counter++;
}
}
System.out.println("No of Posts : "+counter);
}
}
And this throws an error :
Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: (#200) Requires extended permission: read_stream (code 200, subcode null) at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:1186) at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:1112) at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:1053) at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:964) at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:926) at com.restfb.DefaultFacebookClient.fetchConnection(DefaultFacebookClient.java:356) at org.hive.facebook.restFB_tester.main(restFB_tester.java:29)
I have been trying to solve this but couldn't find any luck. I was able to get data if i use "me/feeds" ,that returns user data.I tried finding it on google and tried different ways but didn't help.I have given all permission while creating token.
Please let me know where i am doing wrong or what can be potential solution for this.Thanks in advance.