java - FB SDK not working on OS 7 -
i implementing fb in 1 of app.i using jar 0.8.25. working fine on simulators 5 7.1.and devices works os 5 , 6 not working on device 7 , 7.1.for os 7 after log in success remains on fb page doesn't redirect back. , when press button, error encountered unable refresh access token try again button.
when analyzing on console never finds access token single time os 7.while 5 , 6 working perfectly.
please tell may cause issue.
thanks,
this isn't solution specific problem. mentioned in comments i'm using interface. i'm posting here comment section. not complete solution, need handle flow , expired tokens, show logic of how did this.
for interface open browserfield oauth url: https://www.facebook.com/dialog/oauth?client_id=<app_id>&response_type=token&redirect_uri=http://www.facebook.com/connect/login_success.html&scope=publish_actions
and add listener browser listen redirects after login. once have access token, should persist , close browserfield.
private class oauthscreen extends mainscreen { browserfield browser_field; loadingdialog loading_dialog; public oauthscreen(final command task) { super(vertical_scroll | horizontal_scroll); browserfieldconfig browserconfig = new browserfieldconfig(); browserconfig.setproperty(browserfieldconfig.viewport_width, new integer(display.getwidth())); browser_field = new browserfield(browserconfig); browser_field.addlistener(new browserfieldlistener() { public void documentcreated(browserfield browserfield, scriptengine scriptengine, document document) throws exception { int index = browserfield.getdocumenturl().indexof("#access_token="); if (index == -1) { super.documentcreated(browserfield, scriptengine, document); } else { access_token = browserfield.getdocumenturl().substring(index + "#access_token=".length(), browserfield.getdocumenturl().indexof("&")); persistentobject store = persistentstore.getpersistentobject(store_key); facebooktokens store_tokens = new facebooktokens(); store_tokens.access_token = access_token; store.setcontents(store_tokens); store.commit(); if (task != null) task.execute(); oauthscreen.this.close(); } } public void documentloaded(browserfield browserfield, document document) throws exception { super.documentloaded(browserfield, document); loading_dialog.close(); } }); // whatever loading dialog want, takes while open loading_dialog = loadingdialog.push(loading_field); add(browser_field); browser_field.requestcontent("https://www.facebook.com/dialog/oauth?client_id="+app_id+"&response_type=token&redirect_uri=http://www.facebook.com/connect/login_success.html&scope=publish_actions"); } }
the callback task if want perform call directly after login.
now perform api calls need them. api methods here https://developers.facebook.com/docs/graph-api/reference/v2.0/ methods require access token, should have appended url such as, https://graph.facebook.com/me/feed?access_token=" + access_token
be aware clearing access token won't clear token stored in browser field. , mean can't login next time (because browser still logged in). if want logout need open link in browserfield before clearing local access token "https://www.facebook.com/logout.php?next=http://www.facebook.com/connect/login_success.html&access_token=" + access_token
clearing cookies of browser should suffice, haven't found way this.
Comments
Post a Comment