Joppe De Cuyper
Joppe De Cuyper

Reputation: 414

Java facebook api 0AuthException when using acces token

I am trying to create a java program implementing facebook restfb sdk. I have initialised my fbclient the following way.

FacebookClient fbclient = new DefaultFacebookClient(accesToken,Version.LATEST);

When trying to load ex.1, everything is fine. But, since i dont want to load thousands of posts, when i try ex.2, it gives me 0authexception. Although, if i use the facebook graph api explorer, it has no problem with the limit function. Does anyone know what i might be doing wrong here?

ex,1

Connection<Post> postFeed = fbclient.fetchConnection(pageID + "/feed", Post.class);

e,2

Connection<Post> postFeed = fbclient.fetchConnection(pageID + "/feed?&limit=5", Post.class);

Upvotes: 0

Views: 417

Answers (1)

Joppe De Cuyper
Joppe De Cuyper

Reputation: 414

restfb sdk uses a different style to pass parameters. By reading further in the documentation, i accidentally encountered it. Here's what fixes it.

Connection<Post> postFeed = fbclient.fetchConnection(pageID + "/feed", Post.class,Parameter.with("limit", 5));

Upvotes: 1

Related Questions