fjlopezs / mytracks

Automatically exported from code.google.com/p/mytracks
0 stars 0 forks source link

Authentication error uploading to docs #307

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This issue was masked by 286.  Now that 286 is fixed, we're left with a docs 
auth error:

02-09 18:14:22.144 W/DefaultRequestDirector(15763): Authentication error: 
Unable to respond to any of these challenges: {googlelogin=WWW-Authenticate: 
GoogleLogin realm="http://www.google.com/accounts/ClientLogin", 
service="writely"}
02-09 18:14:22.154 E/MyTracks(15763): HttpException
02-09 18:14:22.154 E/MyTracks(15763): 
com.google.android.apps.mytracks.io.gdata.GDataWrapper$HttpException
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.docs.DocsHelper$2.query(DocsHelper.java:198)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.docs.DocsHelper$2.query(DocsHelper.java:1)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runOne(GDataWrapper.java:
198)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runCommon(GDataWrapper.ja
va:171)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runQuery(GDataWrapper.jav
a:162)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.docs.DocsHelper.requestSpreadsheetId(DocsHel
per.java:172)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.SendToDocs.uploadToDocs(SendToDocs.java:193)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.SendToDocs.doUpload(SendToDocs.java:123)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.SendToDocs.access$0(SendToDocs.java:101)
02-09 18:14:22.154 E/MyTracks(15763): at 
com.google.android.apps.mytracks.io.SendToDocs$1.run(SendToDocs.java:96)
02-09 18:14:22.154 E/MyTracks(15763): at 
android.os.Handler.handleCallback(Handler.java:587)
02-09 18:14:22.154 E/MyTracks(15763): at 
android.os.Handler.dispatchMessage(Handler.java:92)
02-09 18:14:22.154 E/MyTracks(15763): at android.os.Looper.loop(Looper.java:144)
02-09 18:14:22.154 E/MyTracks(15763): at 
android.os.HandlerThread.run(HandlerThread.java:60)
02-09 18:14:22.154 D/MyTracks(15763): GData error encountered: null
02-09 18:14:22.154 D/MyTracks(15763): retrying function/query
02-09 18:14:22.444 W/DefaultRequestDirector(15763): Authentication error: 
Unable to respond to any of these challenges: {googlelogin=WWW-Authenticate: 
GoogleLogin realm="http://www.google.com/accounts/ClientLogin", 
service="writely"}
02-09 18:14:22.464 E/MyTracks(15763): HttpException

Original issue reported on code.google.com by simmonmt@google.com on 9 Feb 2011 at 5:43

Attachments:

GoogleCodeExporter commented 9 years ago
I figured out the problem.  During the changeover from one GData library to 
another, and the associated changes in the HttpException, the processing of 
auth token expirations was broken.  This is particularly hard to test, since 
tokens expire every 14 days.  Anyway, we were looking for the token in the 
message, which is now null, when we should've been reading the status code 
directly.

Here's a sample log from a guinea pig, to whom we are forever grateful:

D/MyTracks( 4654): SendToDocs: Uploading to spreadsheet
D/MyTracks( 4654): GData connection prepared: 
com.google.android.apps.mytracks.io.ModernAuthManager@40599cc0
W/DefaultRequestDirector( 4654): Authentication error: Unable to respond to any 
of these challenges: {googlelogin=WWW-Authenticate: GoogleLogin 
realm="http://www.google.com/accounts/ClientLogin", service="writely"}
E/MyTracks( 4654): HttpException, code 401 message null         
<<<<-------------
E/MyTracks( 4654): 
com.google.android.apps.mytracks.io.gdata.GDataWrapper$HttpException
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.docs.DocsHelper$2.query(DocsHelper.java:198)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.docs.DocsHelper$2.query(DocsHelper.java:1)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runOne(GDataWrapper.java:
198)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runCommon(GDataWrapper.ja
va:171)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runQuery(GDataWrapper.jav
a:162)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.docs.DocsHelper.requestSpreadsheetId(DocsHel
per.java:172)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs.uploadToDocs(SendToDocs.java:193)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs.doUpload(SendToDocs.java:123)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs.access$0(SendToDocs.java:101)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs$1.run(SendToDocs.java:96)
E/MyTracks( 4654):      at android.os.Handler.handleCallback(Handler.java:587)
E/MyTracks( 4654):      at android.os.Handler.dispatchMessage(Handler.java:92)
E/MyTracks( 4654):      at android.os.Looper.loop(Looper.java:123)
E/MyTracks( 4654):      at android.os.HandlerThread.run(HandlerThread.java:60)
D/MyTracks( 4654): GData error encountered: null
D/MyTracks( 4654): Retrying due to auth failure   <<<<<<<<<<<---------------

The keys are the lines with the arrow on them.    

Arrow 1: Note that the message is null, but the status code is 401.  In the log 
which started this bug, we're ignoring the null message and driving on.  Also 
in that initial log, we see that GData error encountered null (which means that 
the message was null, since the GData error message comes from the 
HttpException message in this case.  

Arrow 2: Now that we're looking at the status code, we see it recognizing the 
auth error and retrying.  In the initial log, we don't recognize the auth 
failure, and go back into the normal retry, which fails, since we haven't 
invalidated and refreshed the token.

The fix for this issue is in simmonmt-staging5

Original comment by simmonmt@google.com on 10 Feb 2011 at 2:16

GoogleCodeExporter commented 9 years ago
I figured out the problem.  During the changeover from one GData library to 
another, and the associated changes in the HttpException, the processing of 
auth token expirations was broken.  This is particularly hard to test, since 
tokens expire every 14 days.  Anyway, we were looking for the token in the 
message, which is now null, when we should've been reading the status code 
directly.

Here's a sample log from a guinea pig, to whom we are forever grateful:

D/MyTracks( 4654): SendToDocs: Uploading to spreadsheet
D/MyTracks( 4654): GData connection prepared: 
com.google.android.apps.mytracks.io.ModernAuthManager@40599cc0
W/DefaultRequestDirector( 4654): Authentication error: Unable to respond to any 
of these challenges: {googlelogin=WWW-Authenticate: GoogleLogin 
realm="http://www.google.com/accounts/ClientLogin", service="writely"}
E/MyTracks( 4654): HttpException, code 401 message null         
<<<<-------------
E/MyTracks( 4654): 
com.google.android.apps.mytracks.io.gdata.GDataWrapper$HttpException
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.docs.DocsHelper$2.query(DocsHelper.java:198)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.docs.DocsHelper$2.query(DocsHelper.java:1)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runOne(GDataWrapper.java:
198)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runCommon(GDataWrapper.ja
va:171)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.gdata.GDataWrapper.runQuery(GDataWrapper.jav
a:162)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.docs.DocsHelper.requestSpreadsheetId(DocsHel
per.java:172)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs.uploadToDocs(SendToDocs.java:193)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs.doUpload(SendToDocs.java:123)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs.access$0(SendToDocs.java:101)
E/MyTracks( 4654):      at 
com.google.android.apps.mytracks.io.SendToDocs$1.run(SendToDocs.java:96)
E/MyTracks( 4654):      at android.os.Handler.handleCallback(Handler.java:587)
E/MyTracks( 4654):      at android.os.Handler.dispatchMessage(Handler.java:92)
E/MyTracks( 4654):      at android.os.Looper.loop(Looper.java:123)
E/MyTracks( 4654):      at android.os.HandlerThread.run(HandlerThread.java:60)
D/MyTracks( 4654): GData error encountered: null
D/MyTracks( 4654): Retrying due to auth failure   <<<<<<<<<<<---------------

The keys are the lines with the arrow on them.    

Arrow 1: Note that the message is null, but the status code is 401.  In the log 
which started this bug, we're ignoring the null message and driving on.  Also 
in that initial log, we see that GData error encountered null (which means that 
the message was null, since the GData error message comes from the 
HttpException message in this case.  

Arrow 2: Now that we're looking at the status code, we see it recognizing the 
auth error and retrying.  In the initial log, we don't recognize the auth 
failure, and go back into the normal retry, which fails, since we haven't 
invalidated and refreshed the token.

The fix for this issue is in simmonmt-staging5

Original comment by simmonmt@google.com on 10 Feb 2011 at 2:46

GoogleCodeExporter commented 9 years ago

Original comment by simmonmt@google.com on 10 Feb 2011 at 3:00

GoogleCodeExporter commented 9 years ago

Original comment by simmonmt@google.com on 10 Feb 2011 at 9:24

Attachments:

GoogleCodeExporter commented 9 years ago
Tested the APK above and it works. First uploaded to Docs alone, the to Fusion 
Tables and Docs. I didn't have the "My Tracks" Spreadsheet before, so it got 
ceated in the first run. In the second rund, a second row has been added as 
expected.

Only thing I notice is that the fusion table URL is missing in the "Map" 
column. But that should be another issue, I think.

HTC Desire, Android 2.2

Original comment by marian.s...@gmail.com on 10 Feb 2011 at 10:45