Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
OAuthClientRequest bearerClientRequest = new OAuthBearerClientRequest("https://graph.facebook.com/me")
         .setAccessToken(accessToken).buildQueryMessage();

OAuthResourceResponse resourceResponse = oAuthClient.resource(bearerClientRequest, OAuth.HttpMethod.GET, OAuthResourceResponse.class);
 

 

Below is an example to post a photo picture to Facebook with the retrieved accessToken.

Code Block
OAuthClientRequest bearerClientRequest = new OAuthBearerClientRequest("https://graph.facebook.com/{album-id}/photos")
         .setAccessToken(accessToken)
         .buildQueryMessage();

bearerClientRequest.setHeader(OAuth.HeaderType.CONTENT_TYPE, "multipart/form-data");
bearerClientRequest.setBody(photo);

OAuthResourceResponse resourceResponse = oAuthClient.resource(bearerClientRequest, OAuth.HttpMethod.POST, OAuthResourceResponse.class);

...