Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-729] Android: KS auth error in twitter / mashup example

GitHub Issuen/a
Resolution Date2011-04-17T01:54:03.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.3.0
ReporterMarshall Culpepper
AssigneeDon Thorp


Relevant error from log:
04-06 03:12:54.182: WARN/DefaultRequestDirector(17082): Authentication error: Unable to respond to any of these challenges: {}


  1. Bill Dawson 2011-04-15

    I'm havin a go at this (just mentioning so we don't duplicate effort)

  2. Bill Dawson 2011-04-15

    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..."

  3. Bill Dawson 2011-04-15

    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.

  4. Don Thorp 2011-04-15

    (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...

  5. Don Thorp 2011-04-15

    (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...

JSON Source