Android - facebook发布墙上的certxception文本

时间:2014-09-30 10:37:48

标签: android facebook facebook-graph-api

我想在单击按钮时在墙上发布一个简单的文本,但是我得到了下一个错误

09-30 13:33:57.640  21676-21676/excuseme.studio3s.com.excuseme I/System.out﹕ {Response:  responseCode: 403, graphObject: null, error: {HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200) The user hasn't authorized the application to perform this action}, isFromCache:false}

我的代码

   Session.openActiveSession(this, true, new Session.StatusCallback() {

        // callback when session changes state
        @Override
        public void call(Session session, SessionState state, Exception exception) {


            if (session.isOpened()) {

                if (session.getPermissions().contains("publish_actions") == false) {
                    System.out.println("publish");
                    Session.NewPermissionsRequest newPermissionsRequest = new Session
                            .NewPermissionsRequest(FacebookTest.this, Arrays.asList("publish_actions"));
                    session.requestNewPublishPermissions(newPermissionsRequest);
                } else {
                    System.out.println(Arrays.toString(session.getPermissions().toArray()));
                }

                Bundle params = new Bundle();
                params.putString("message", "This is a test message" + Math.random());
                new Request(
                        session,
                        "/me/feed",
                        params,
                        HttpMethod.POST,
                        new Request.Callback() {
                            public void onCompleted(Response response) {
                                System.out.println(response.toString());
                            }
                        }
                ).executeAsync();
            } else {
                // session not opened

                System.out.println("isOpened == false");


            }

我的输出:

 09-30 13:33:57.160  21676-21676/excuseme.studio3s.com.excuseme I/System.out﹕ [public_profile, publish_actions]

09-30 13:33:57.400  21676-21810/excuseme.studio3s.com.excuseme D/dalvikvm﹕ GC_FOR_ALLOC freed 265K, 4% free 8045K/8348K, paused 15ms, total 16ms
09-30 13:33:57.640  21676-21676/excuseme.studio3s.com.excuseme I/System.out﹕ {Response:  responseCode: 403, graphObject: null, error: {HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200) The user hasn't authorized the application to perform this action}, isFromCache:false}

我看到我已经获得了我需要的许可.. https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed#publish

我哪里错了?

0 个答案:

没有答案