[TIMOB-729] Android: KS auth error in twitter / mashup example
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:54:03.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.3.0 |
Components | Android |
Labels | android |
Reporter | Marshall Culpepper |
Assignee | Don Thorp |
Created | 2011-04-15T02:35:16.000+0000 |
Updated | 2011-04-17T01:54:03.000+0000 |
Description
Relevant error from log:
04-06 03:12:54.182: WARN/DefaultRequestDirector(17082):
Authentication error: Unable to respond to any of these challenges:
{}
I'm havin a go at this (just mentioning so we don't duplicate effort)
Kudos to Don for suggesting to me to comment-out the TiHTTPClient.java line that sets setRequestHeader("X-Requested-With","XMLHttpRequest");. Twitter works after that.
i checked the Ti iPhone SDK. In TiNetworkHTTPClientProxy.m, the user agent is set, but not X-Requested-With. Do we really need X-Requested-With?
(Interestingly, this command line works for me, so Im not sure what is going on at the Twitter end to reject the calls we were making):
curl -H "X-Requested-With: XMLHttpRequest" "http://username:password@twitter.com/statuses/friends_timeline.json?count=5";">http://username:password@twitter.com/statuses/friends_timeline.json..."
Addendum: Worried as I was that maybe there also might be an angle involved with the Apache HTTP client (which Android uses), I changed Ti iphone sdk's TiNetworkHTTPClientProxy.m to set the "X-Requested-With", and indeed it failed. So that just confirms that the Apache HTTP client is NOT the culprit. The error occurs "cross-platform" when that X-Requested-With header is included.
(from [c6731d8c21f8485795ab32bc1fba97a73dbd40ec]) [#729 state:resolved] Auth failure with twitter is fixed by removing the the X-Request-With header. Thanks to @billdawson for tracking this down. http://github.com/appcelerator/titanium_mobile/commit/c6731d8c21f8485795ab32bc1fba97a73dbd40ec"> http://github.com/appcelerator/titanium_mobile/commit/c6731d8c21f84...
(from [c883ec4ec485ea88552d8eb33d29b2383abce66e]) [#729 state:resolved] Updated to conditionally not send the X-Requested-With header if twitter.com http://github.com/appcelerator/titanium_mobile/commit/c883ec4ec485ea88552d8eb33d29b2383abce66e"> http://github.com/appcelerator/titanium_mobile/commit/c883ec4ec485e...