Blackberry Facebook SDK,在发布状态更新时遇到403 Forbidden

时间:2012-02-07 11:32:42

标签: facebook blackberry sdk

我想将Facebook与我的Blackberry应用程序集成。为此,我已经下载了适用于Blackberry的Facebook SDK。我使用以下代码将状态发布到用户的FB:

String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
String APPLICATION_ID = "xxxxxxxxxxxx";
String APPLICATION_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String[] PERMISSIONS = Facebook.Permissions.USER_DATA_PERMISSIONS;              

ApplicationSettings as = new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, PERMISSIONS);
Facebook fb = Facebook.getInstance(as);

try{
 User user = fb.getCurrentUser();
 String result = user.publishStatus("Hello world!");
 if ((result != null) && !result.trim().equals("")) {
    Dialog.inform("Publish Success.");
 } else {
    Dialog.inform("Publish Failed.");
 }

}catch(FacebookException fe){
  fe.printStackTrace();
}

登录成功,它正确地返回我的应用程序并以json格式获取用户详细信息。但是当publishStatus()被触发时,进程失败。以下是publishStatus()操作的调试窗口详细信息。

2012-02-07 10:46:51 [INFO] HTTP-POST (TCP WIFI):  https://graph.facebook.com/xxxxxxxxxxx/feed;interface=wifi
2012-02-07 10:46:51 [INFO] HTTP-POST Response:  403 Forbidden
2012-02-07 10:46:51 [INFO] HTTP-POST Body:  text/javascript; charset=UTF-8(0)

403禁止错误的原因是什么?访问令牌是否应与上述URL一起使用?如果是,如何整合它?

1 个答案:

答案 0 :(得分:1)

必须更改权限并解决问题。

String[] PERMISSIONS = Facebook.Permissions.ALL_PERMISSIONS;