缺少用户cookie(验证会话用户)facebook SDK

时间:2013-11-07 02:26:13

标签: android facebook sdk

我在mycode中实现了android SDK for android。我已将用户令牌facebook保存在服务器中。并用它邀请Facebook朋友的请求。但它显示错误

API错误代码:110 API错误描述:无效的用户ID 错误消息:缺少用户cookie(以验证会话用户)

这是我发送请求的代码

Session msession;
Bundle params = new Bundle();
params.putString("to", id_friend);
params.putString("message", "Invite your friend");

msession = Session.getActiveSession();

SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa");
Date convertedDate = new Date();
try {
     convertedDate = dateFormat.parse(fb_token_expired);
} catch (ParseException e) {

     e.printStackTrace();
}
    final List<String> PERMISSIONS = Arrays.asList("read_requests", "read_mailbox", "manage_notifications");

AccessToken token=AccessToken.createFromExistingAccessToken(fb_token_user, convertedDate, null,AccessTokenSource.CLIENT_TOKEN, PERMISSIONS);

 msession = Session.openActiveSessionWithAccessToken(c, token, new StatusCallback(){
 @Override
 public void call(Session aSession, SessionState aState, Exception aException) {
            if (aException != null) {

            }


        }
   });

if(msession.isOpened()){
        requestsDialog = (new WebDialog.RequestsDialogBuilder(this,msession,params))
                  .setOnCompleteListener(new OnCompleteListener() {

                        @Override
                        public void onComplete(Bundle values,
                            FacebookException error) {
                            if (error != null) {
                                if (error instanceof FacebookOperationCanceledException) {

                                        Toast.makeText(getApplicationContext(), "Request cancelled", Toast.LENGTH_SHORT).show();
                                } else {
                                    Toast.makeText(getApplicationContext(), 
                                        "Network Error", 
                                        Toast.LENGTH_SHORT).show();
                                }
                            } else {
                                final String requestId = values.getString("request");
                                if (requestId != null) {


                                    Log.e("success", "success");


                                } else {
                                    Toast.makeText(getApplicationContext(), "Request cancelled", Toast.LENGTH_SHORT).show();
                                }
                            }   
                        }



                    })
                    .build();
            requestsDialog.show();
        }

任何解决方案?谢谢:))

0 个答案:

没有答案