Android: Google Authentication + Ubertoken -


ok, give up. have experience using google's issueauthtoken , mergesession authenticate google services not have official api access? in case i'm trying google bookmarks (from google.com/bookmarks).

i sid , lsid using getauthtoken , works fine. call

uri issue_auth_token_url = uri.parse("https://accounts.google.com/issueauthtoken?service=bookmarks&session=false");  string url = issue_auth_token_url.buildupon()                  .appendqueryparameter("sid", sid)                  .appendqueryparameter("lsid", lsid)                  .build().tostring(); 

i receive "ubertoken".

i mergesession , that's goes wrong:

string url2 = "https://accounts.google.com/mergesession?source=chrome&uberauth="+ubertoken+"&service=bookmarks&continue=https%3a%2f%2fwww.google.com%2fbookmarks%2f"; httpget getcookies = new httpget(url2); 

looking through headers of getcookies not seeing cookies should see, , see things x-frame-options: deny.

help (please)!

okay friends, here go. seems above unreliable/broken @ least of august 2013. how i'm doing , seems work. tries above first, , if fails, goes on method #2.

  final account acct = am.getaccountsbytype("com.google")[acctid];   final string tokentype = "weblogin:service=bookmarks&continue=https://www.google.com/bookmarks/";      am.getauthtoken(acct, tokentype, null, this, new accountmanagercallback<bundle>() {         @override         public void run(accountmanagerfuture<bundle> future) {             try {                 final string accesstoken = future.getresult().getstring(accountmanager.key_authtoken);                 if (accesstoken.contains("will_not_sign_in")) {                     am.getauthtoken(acct, "sid", null, mainactivity.this, new accountmanagercallback<bundle>() {                         @override                         public void run(accountmanagerfuture<bundle> future) {                             try {                                 sid = future.getresult().getstring(accountmanager.key_authtoken);                             } catch (operationcanceledexception e) {                                 finish();                             } catch (exception e) {                                 e.printstacktrace();                             }                              am.getauthtoken(acct, "lsid", null, mainactivity.this, new accountmanagercallback<bundle>() {                                 @override                                 public void run(accountmanagerfuture<bundle> future) {                                     try {                                         lsid = future.getresult().getstring(accountmanager.key_authtoken);                                     } catch (operationcanceledexception e) {                                         finish();                                     } catch (exception e) {                                         e.printstacktrace();                                     }                                      thread t = new thread() {                                         public void run() {                                             try {                                                 uri issue_auth_token_url = uri.parse("https://www.google.com/accounts/issueauthtoken?service=gaia&session=false");                                                 uri token_auth_url = uri.parse("https://www.google.com/accounts/tokenauth");                                                  final httpclient httpclient = new defaulthttpclient();                                                 httpclient.getparams().setbooleanparameter(coreprotocolpnames.use_expect_continue, false);                                                 httpclient.getparams().setbooleanparameter(clientpnames.handle_redirects, true);                                                  string url = issue_auth_token_url.buildupon().appendqueryparameter("sid", sid).appendqueryparameter("lsid", lsid).build().tostring();                                                 httppost getubertoken = new httppost(url);                                                 httpresponse response = httpclient.execute(getubertoken);                                                  string ubertoken = entityutils.tostring(response.getentity(), "utf-8");                                                  final string accesstoken2 = token_auth_url.buildupon()                                                         .appendqueryparameter("source", "android-browser")                                                         .appendqueryparameter("auth", ubertoken)                                                         .appendqueryparameter("continue", "https://www.google.com/bookmarks/").build().tostring();                                                  //do stuff                                             } catch (exception e) {                                                 e.printstacktrace();                                             }                                         }                                     };                                     t.start();                                 }                             }, null);                         }                     }, null);                 } else {                                  //do stuff                 }             } catch (operationcanceledexception e) {                 finish();             } catch (exception e) {                 finish();                              }         }     }, null);    

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -