FacebookException [statusCode=403, response=HttpResponse{statusCode=403, respons
eAsString='{"error":{"message":"(#200) Must have a valid access_token to access
this endpoint","type":"OAuthException","code":200}}
', is=sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@6e0031c0, stre
amConsumed=true}, errorType=OAuthException, errorMessage=(#200) Must have a vali
d access_token to access this endpoint, errorCode=200]
The code snippet for my test application is mentioned below:
try {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthAppId("XXXXXXX")
.setOAuthAppSecret("XXXXXXXXXXXXXXXXXX")
.setOAuthAccessToken("XXXXXXXXXXXXXXX"); //this access token I have generated using the URL mentioned above.
FacebookFactory ff = new FacebookFactory(cb.build());
Facebook facebook = ff.getInstance();
ResponseList<User> results = facebook.searchUsers("Sachin Tendulkar");
System.out.println(results.getCount());
} catch (FacebookException e) {
e.printStackTrace();
}
The line marked in red is the failing point.