0

我想通过我的应用程序向我的朋友发送 Facebook 通知。我通过restfb库使用了以下通知api

facebookClient = new DefaultFacebookClient(vAccessTokenDetails.getVAccessToken());

String app_access_token = facebookClient.obtainAppAccessToken("485626xxxxxx614","d9428570ef5ae82609b6xxxxxxxb").getAccessToken();

publishMessageResponse = facebookClient.publish(post.getVFriendId()+"/notifications?access_token="+app_access_token, FacebookType.class, Parameter.with("template", post.getVMessage()), Parameter.with("href", " http://www.wiinkURL.com ")); vPostId = publishMessageResponse.getId();

但我得到 com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: (#15) This method must be called with an app access_token

4

1 回答 1

1

FacebookClient 对象应使用 app_access_token 而不是 access_token 创建。

FacbookClient facebookClientAppAccessToken = 
    new DefaultFacebookClient( app_access_token );
publishMessageResponse = facebookClientAppAccessToken.publish(..);
于 2013-02-14T10:43:50.197 回答