I was doing some coding today using this code without a problem:
private static List<Post> getPosts(final String pageId, final String id, final String secret) {
FacebookClient.AccessToken accessToken = new DefaultFacebookClient().obtainAppAccessToken(id, secret);
FacebookClient client = new DefaultFacebookClient(accessToken.getAccessToken(), Version.VERSION_2_10);
Connection<Post> pageFeed = client.fetchConnection(pageId + "/feed", Post.class);
Iterator<List<Post>> feed = pageFeed.iterator();
List<Post> allPosts = feed.hasNext() ? feed.next() : Collections.emptyList();
return allPosts;
}
And then it suddenly stopped working and began throwing a FacebookGraphException. After a little bit of digging I found that accessToken.getAccessToken() was returning an odd String which certainly doesn't look like a valid access token. I tried using that in the API Graph Explorer that FB provides and obviously it doesn't work. Reading restfb and Facebook's documentation I can't find a clear answer on how obtainAppAccessToken can return a token that's not valid.
Can someone shed some light here?
Thanks