FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN, MY_APP_SECRET);
User user = facebookClient.fetchObject("me", User.class);
I am using the latest RestFb 1.9 Version
Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: Error validating access token: Session has expired on Thursday, 09-Apr-15 17:00:00 PDT. The current time is Thursday, 09-Apr-15 17:37:09 PDT. (code 190, subcode 463)
at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:1189)
at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:1104)
at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:1038)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:951)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:914)
at com.restfb.DefaultFacebookClient.fetchConnection(DefaultFacebookClient.java:378)
at helloworld.FB.readMessage(FB.java:25)
at helloworld.FB.main(FB.java:20)
Hi ankur,
the access token is expired.
you can check this here: https://developers.facebook.com/tools/debug/access_token/
and the error message tells this, too :)
Cheers
Norbert
Hi,
you can use the graph api request for access token validation. To do this you need an app access token.
https://developers.facebook.com/docs/facebook-login/access-tokens#debug
Should work with restfb, too. You only need a Facebook Client with a app access token.
Regards
Norbert