java - (#200) The user hasn't authorized the application to perform this action android facebook SDK -
i posting on wall in facebook sdk android getting i'll post code below
{response: responsecode: 403, graphobject: null, error: {httpstatus: 403, errorcode: 200, errortype: oauthexception, errormessage: (#200) user hasn't authorized application perform action}, isfromcache:false} private void poststatusupdate(final string fbpost) { 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 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 /me api request.executemerequestasync(session, new request.graphusercallback() { // callback after graph api response 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 good"; //toast.maketext(getapplicationcontext(),"posted successfully", toast.length_short).show(); appmsg.maketext(tabactivity.this, "posted 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\n"/*+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()); } } } }); } } }); }
just open permission dialogue publish_action permission update access token , post message
facebook post on behalf not working in android facebook sdk 3.0.2
Comments
Post a Comment