(# 200) O utilizador não autorizado a aplicação para executar esta ação android facebook SDK

? user12345 @ | Original: StackOverFlow
---

Estou postando na minha parede no facebook SDK do Android, mas estou recebendo Vou postar meu código abaixo

{ Resposta: responseCode : 403, graphObject : null, error : { HTTPStatus : 403, errorCode : 200, errorType : OAuthException, errorMessage : (# 200) O utilizador não autorizado a aplicação para executar esta ação }, isFromCache : false }     postStatusUpdate private void ( fbpost final String ) {             Log.d ( " postStatusUpdate ", fbpost ) ;

       Session.openActiveSession(this, true, new Session.StatusCallback() {
            // callback when session changes state
            @SuppressWarnings("deprecation")
            @Override
            public void call(final Session session, SessionState state, Exception exception) {
            if(session.isClosed()){
                 Log.i("postStatusUpdate session.isClosed", "message not posted session is closed");
             }
             if (session.isOpened()) {
               Log.i("session.isOpened", "session.isOpened");

             if (!session.isOpened()) { 
                Log.w("myConsultant11111111111","Session closed");
                Session.OpenRequest openRequest = null;
                openRequest = new Session.OpenRequest(TabActivity.this);

                if (openRequest != null) {
                    openRequest.setDefaultAudience(SessionDefaultAudience.FRIENDS);
                    openRequest.setPermissions(Arrays.asList("publish_stream","publish_actions"));
                    openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK);

                   session.openForPublish(openRequest);
                }

            }

             Log.i("session.getPermissions() tab", ""+session.getPermissions());


                //fbpostcheck = "if";

               // make request to the /me API
                Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

                  // callback after Graph API response with user object
                  @Override
                  public void onCompleted(GraphUser user, Response response) {
                   //session.requestNewReadPermissions(newPermissionsRequest2);

                    if (user != null) {
                      try {

                        Session session = Session.getActiveSession();
                        //session.requestNewReadPermissions(newPermissionsRequest);
                        if (!session.isOpened() && !session.isClosed()) {
                           // session.openForRead(new Session.OpenRequest(this).setCallback(statusCallback));

                        } else {
                           // Session.openActiveSession(this, true, statusCallback);
                            Log.d("myLogs", "Test 1");
                            final String message = fbpost;
                            Request request = Request
                                    .newStatusUpdateRequest(Session.getActiveSession(), message, new Request.Callback() {
                                        @Override
                                        public void onCompleted(Response response) {
                                            //showPublishResult(message, response.getGraphObject(), response.getError());
                                             Log.i("onCompleted", response.toString());
                                             Log.i("getGraphObject", ""+response.getGraphObject());

                                             showPublishResult(message, response.getGraphObject(), response.getError());
                                        }

                                        private void showPublishResult(String message,GraphObject graphObject,FacebookRequestError error) {
                                            // TODO Auto-generated method stub
                                            String title = null;
                                            String alertMessage = null;
                                            if (error == null) {
                                                title = "Success";

                                                alertMessage = "All is good";
                                                //Toast.makeText(getApplicationContext(),"Posted successfully", Toast.LENGTH_SHORT).show();
                                                AppMsg.makeText(TabActivity.this, "Posted to facebook", AppMsg.STYLE_INFO).show();
                                            } else {
                                                title = "Error";
                                                alertMessage = error.getErrorMessage();
                                                Log.i("alertMessage", alertMessage.toString());
                                                AppMsg.makeText(TabActivity.this, "Error in Posting Message on facebook
"/*+alertMessage*/, AppMsg.STYLE_INFO).show();
                                                //Toast.makeText(getApplicationContext(),alertMessage, Toast.LENGTH_LONG).show();

                                            }
                                        }
                                    });
                            request.executeAsync();
                        }

                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                         Log.i("Exception user data", e.toString());
                    }

                    }

                  }

                });




             }

            }

       });


    }
---

Top 5 Responder

1Jatiendar Kumar @

basta abrir o diálogo de permissão com a permissão publish_action então atualizar seu token de acesso e, em seguida, enviar a sua mensagem

http://stackoverflow.com/questions/17878500/facebook-post-on-your-behalf-is-not-working-in-android-facebook-sdk-3-0-2?rq=1