android - FacebookAuthorizationException: User logged in as different Facebook user -
android - FacebookAuthorizationException: User logged in as different Facebook user -
i putting simple android activity displays facebook placepicker. when user selects place list, should post selection wall. should not require login button; app not request permissions (publish_actions
in case) until needed.
my placepicker works fine. places expect loaded, , selecting 1 triggers appropriate function, requestnewpublishpermissions()
phone call fails every time. exception beingness thrown is:
com.facebook.facebookauthorizationexception: user logged in different facebook user.
i have been able find 2 other discussions online include error message, , neither of them of help me. have logged out of facebook app, logged out of facebook on mobile browser, , still throws same exception.
what heck going on here?
oncreate()
log.d(tag, "checkin: oncreate"); super.oncreate(savedinstancestate); isshared = false; setcontentview(r.layout.activity_checkin); initlocationmanager(); initplacepickerfragment(getsupportfragmentmanager()); lifecyclehelper = new uilifecyclehelper(this, statuscallback); lifecyclehelper.oncreate(savedinstancestate); settings.addloggingbehavior(loggingbehavior.include_access_tokens); session session = session.getactivesession(); if (session == null) { log.d(tag, "checkin: null session"); if (savedinstancestate != null) { session = session.restoresession(this, null, statuscallback, savedinstancestate); } if (session == null) { session = new session(this); } session.setactivesession(session); if (session.getstate().equals(sessionstate.created_token_loaded)) { session.openforread(new session.openrequest(this).setcallback(statuscallback)); } } if (savedinstancestate != null) { pendingpublishreauthorization = savedinstancestate.getboolean(pending_publish_key, false); }
publish()
log.d(tag,"checkin: publishing check in"); session session = session.getactivesession(); if (session != null){ // check publish permissions list<string> permissions = session.getpermissions(); (string s : permissions) { log.d(tag, "checkin: permission: " + s); } if (!issubsetof(permissions, permissions)) { // false, , loops endlessly log.d(tag, "checkin: getting permissions"); pendingpublishreauthorization = true; session.newpermissionsrequest newpermissionsrequest = new session.newpermissionsrequest(this, permissions); newpermissionsrequest.setcallback(new statuscallback() { @override public void call(session session, sessionstate state, exception exception) { log.d(tag, "checkin: newpermissionsrequest.call()"); log.d(tag, "checkin: " + state.tostring()); log.e(tag, "checkin: " + exception.tostring()); } }); session.requestnewpublishpermissions(newpermissionsrequest); return; } else { log.d(tag, "checkin: has permissions"); } // activity has never gotten far bundle postparams = new bundle(); postparams.putstring("name", "some"); postparams.putstring("caption", "update caption"); postparams.putstring("description", "checked in somewhere cares"); postparams.putstring("link", "http://www.redrobin.com/"); request.callback callback= new request.callback() { public void oncompleted(response response) { log.d(tag, "checkin: set!"); isshared = false; checkinactivity.this.isshared = false; jsonobject graphresponse = response .getgraphobject() .getinnerjsonobject(); string postid = null; seek { postid = graphresponse.getstring("id"); } grab (jsonexception e) { log.i(tag, "checkin: json error " + e.getmessage()); } facebookrequesterror error = response.geterror(); if (error != null) { toast.maketext(checkinactivity.this, error.geterrormessage(), toast.length_short).show(); } else { toast.maketext(checkinactivity.this, postid, toast.length_long).show(); } } }; log.d(tag, "checkin: making me/feed request"); request request = new request(session, "me/feed", postparams, httpmethod.post, callback); requestasynctask task = new requestasynctask(request); task.execute(); }
output:
checkin: oncreate checkin: initlocationmanager checkin: initplacepickerfragment checkin: onresume checkin: session state changed: opened checkin: new location found checkin: setuppickplacefragment checkin: found place // place selected checkin: dopoststory checkin: session either open or closed. sharing checkin: session state changed: closed checkin: session state changed: opened checkin: publishing check in checkin: getting permissions checkin: onpause checkin: onsaveinstancestate checkin: onactivityresult checkin: onresume checkin: newpermissionsrequest.call() checkin: opened checkin: com.facebook.facebookauthorizationexception: user logged in different facebook user. at point output starts repeating endlessly either "newpermissionsrequest.call()" or "session state changed: opened. publishing check in."
i didn't want overload post code, please allow me know if there other functions helpful see here.
android facebook session authentication facebook-android-sdk
Comments
Post a Comment