java - Uber Refresh Authenticator crash -
my app receives accesstoken
, refreshtoken
, expirytimeinmillis
after doing uber websetup. these storing in file via storedcredential
. whenever have create session create credential
follows reading values stored in storedcredential
.
private credential createcredential(){ credential.builder builder = new credential.builder(new credential.accessmethod() { @override public void intercept(httprequest request, string accesstoken) throws ioexception { /** * nothing */ } @override public string getaccesstokenfromrequest(httprequest request) { /** * nothing */ return null; } }); builder.settransport(new mockhttptransport()); builder.setjsonfactory(new mockjsonfactory()); builder.setclientauthentication(new basicauthentication("user","pass")); string query = ""; try { query = urlencoder.encode("mock", "utf-8"); } catch (unsupportedencodingexception e) { log.v(tag,"unsupportedencodingexception "); } string url = "http://mockaddress.com/search?q=" + query; builder.settokenserverencodedurl(url); return builder.build(); } public void setcredentialsfromwebsetup(string accesstoken, string refreshtoken, long expire_at){ credential = createcredential(); credential.setaccesstoken(accesstoken); credential.setrefreshtoken(refreshtoken); credential.setexpirationtimemilliseconds(expire_at); }
my problem is:
the
accesstoken
expired, , don't know how renew usingrefreshtoken
.i thought uber sdk handles renewing accesstoken passing
accesstoken
,refreshtoken
,expirytime
, looking @ uber-java-sdk code.how notified of new
accesstoken
after renewed usingrefreshtoken
.
i don't have client login uber. don't have uber app on device. using uber-rides-java sdk build app uses uber api's book/cancel/view ride details.
i seeing crash , not available related problem.
e/androidruntime(20417): java.lang.illegalargumentexception: no json input found e/androidruntime(20417): @ com.google.api.client.repackaged.com.google.common.base.preconditions.checkargument(preconditions.java:92) e/androidruntime(20417): @ com.google.api.client.util.preconditions.checkargument(preconditions.java:49) e/androidruntime(20417): @ com.google.api.client.json.jsonparser.startparsing(jsonparser.java:222) e/androidruntime(20417): @ com.google.api.client.json.jsonparser.parse(jsonparser.java:379) e/androidruntime(20417): @ com.google.api.client.json.jsonparser.parse(jsonparser.java:354) e/androidruntime(20417): @ com.google.api.client.json.jsonobjectparser.parseandclose(jsonobjectparser.java:87) e/androidruntime(20417): @ com.google.api.client.json.jsonobjectparser.parseandclose(jsonobjectparser.java:81) e/androidruntime(20417): @ com.google.api.client.http.httpresponse.parseas(httpresponse.java:459) e/androidruntime(20417): @ com.google.api.client.auth.oauth2.tokenrequest.execute(tokenrequest.java:307) e/androidruntime(20417): @ com.google.api.client.auth.oauth2.credential.executerefreshtoken(credential.java:570) e/androidruntime(20417): @ com.google.api.client.auth.oauth2.credential.refreshtoken(credential.java:489) e/androidruntime(20417): @ com.uber.sdk.rides.auth.credentialsauthenticator.refreshandsign(credentialsauthenticator.java:97) e/androidruntime(20417): @ com.uber.sdk.rides.auth.credentialsauthenticator.reauth(credentialsauthenticator.java:77) e/androidruntime(20417): @ com.uber.sdk.rides.auth.credentialsauthenticator.refresh(credentialsauthenticator.java:58) e/androidruntime(20417): @ com.uber.sdk.rides.client.internal.refreshauthenticator.authenticate(refreshauthenticator.java:46) e/androidruntime(20417): @ okhttp3.internal.http.httpengine.followuprequest(httpengine.java:893) e/androidruntime(20417): @ okhttp3.realcall.getresponse(realcall.java:276) e/androidruntime(20417): @ okhttp3.realcall$applicationinterceptorchain.proceed(realcall.java:198) e/androidruntime(20417): @ okhttp3.logging.httplogginginterceptor.intercept(httplogginginterceptor.java:142) e/androidruntime(20417): @ okhttp3.realcall$applicationinterceptorchain.proceed(realcall.java:187) e/androidruntime(20417): @ com.uber.sdk.rides.client.internal.apiinterceptor.intercept(apiinterceptor.java:57) e/androidruntime(20417): @ okhttp3.realcall$applicationinterceptorchain.proceed(realcall.java:187) e/androidruntime(20417): @ okhttp3.realcall.getresponsewithinterceptorchain(realcall.java:160) e/androidruntime(20417): @ okhttp3.realcall.access$100(realcall.java:30) e/androidruntime(20417): @ okhttp3.realcall$asynccall.execute(realcall.java:127) e/androidruntime(20417): @ okhttp3.internal.namedrunnable.run(namedrunnable.java:32) e/androidruntime(20417): @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) e/androidruntime(20417): @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) e/androidruntime(20417): @ java.lang.thread.run(thread.java:818) w/activitymanager( 1063): force finishing activity com.iamplus.uberapp/.mainactivity
it looks you're using the uber java sdk on android. please utilize uber android sdk not utilize google oauth credential class, , has lighter weight implementation.
Comments
Post a Comment