jpurcell/birdhouse — Issue #25: get_access_token not getting the access token
Author: anubisza14
Created: 2011-10-10 12:32:32+00:00
State: open

Hi, I'm having issues getting properly validated. For all intents logging in appears to work, so the webview appears, the accept button can be clicked to accept the login, the webview closes and the control passes back to the app.
However if I try and make an API call to http://api.twitter.com/1/account/verify_credentials.json, I get an error that it is unauthorised.
Tracing the process flow through, in get_access_token, it nevers gets beyond if (resp!=false), so cfg.access_token etc are never set, so it looks like the access token is never collected.
I've included the stacktrace below, any help greatly received!!

I/TiAPI ( 301): (kroll$5: app://app.js) [30843,42394] ----- Initializing Authorization Sequence -----
D/TiAPI ( 301): (kroll$5: app://app.js) [4,42398] fn-authorize: use this callback function: "org.appcelerator.titanium.kroll.KrollCallback@40866890"
D/TiAPI ( 301): (kroll$5: app://app.js) [23,42421] fn-api: callback sent is "org.appcelerator.titanium.kroll.KrollCallback@406b70e8"
D/TiAPI ( 301): (kroll$5: app://app.js) [4,42425] fn-api: force authorization is false
I/TiAPI ( 301): (kroll$5: app://app.js) [35,42460] ----- Initializing API Request Sequence -----
D/TiAPI ( 301): (kroll$5: app://app.js) [6,42466] access_token is typof: string
D/TiAPI ( 301): (kroll$5: app://app.js) [292,42758] fn-api: accessor is {"tokenSecret":"","consumerSecret":"MYCONSUMERSECRET"}
D/dalvikvm( 301): GC_CONCURRENT freed 975K, 45% free 5285K/9543K, external 926K/1038K, paused 17ms+19ms
D/dalvikvm( 301): GC_CONCURRENT freed 1409K, 47% free 5106K/9543K, external 926K/1038K, paused 17ms+22ms
D/TiAPI ( 301): (kroll$5: app://app.js) [9932,52690] the API request message: {"action":"https:\/\/api.twitter.com\/oauth\/request_token","method":"POST","parameters":[["oauth_callback","http:\/\/my.ip.address\/myapp\/twitter_callback_mobile.php"],["oauth_consumer_key","MYCONSUMERKEY"],["oauth_signature_method","HMAC-SHA1"],["oauth_timestamp","1318249691"],["oauth_nonce","adeKLiBCq5HIGetMPPgMT7aikd6HJc2Ggk8oJFAPTd"],["oauth_version","1.0"],["oauth_signature","EfbbIGIkdwRZn6uxC3nqykjUNCU="]]}
D/TiAPI ( 301): (kroll$5: app://app.js) [260,52950] api url: https://api.twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fmy.ip.address%2Fmyapp%2Ftwitter_callback_mobile.php&oauth_consumer_key=MYCONSUMERKEY&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1318249691&oauth_nonce=adeKLiBCq5HIGetMPPgMT7aikd6HJc2Ggk8oJFAPTd&oauth_version=1.0&oauth_signature=EfbbIGIkdwRZn6uxC3nqykjUNCU%3D
D/TiHttpClient( 301): (kroll$5: app://app.js) [95,53045] Setting ready state to 1
I/TiHttpClient( 301): (kroll$5: app://app.js) [3,53048] Twitter: not sending X-Requested-With header
D/TiHttpClient( 301): (TiHttpClient-7) [2042,55090] Setting ready state to 2
D/TiHttpClient( 301): (TiHttpClient-7) [10,55100] Setting ready state to 3
D/TiHttpClient( 301): (TiHttpClient-7) [7,55107] Setting ready state to 4
D/TiAPI ( 301): (kroll$5: app://app.js) [12,55119] The API response was oauth_token=11E3y8VRGqVDj274IWUmejtEMgfUQDvblhKTe1dr0&oauth_token_secret=qRuy9lt3RXHSfwnjn23TGnT4uXzf7QraH9Ahoji9RB8&oauth_callback_confirmed=true
D/TiAPI ( 301): (kroll$5: app://app.js) [3,55122] fn-api: we are calling a callback function
D/TiAPI ( 301): (kroll$5: app://app.js) [41,55163] fn-get_request_token: response was oauth_token=11E3y8VRGqVDj274IWUmejtEMgfUQDvblhKTe1dr0&oauth_token_secret=qRuy9lt3RXHSfwnjn23TGnT4uXzf7QraH9Ahoji9RB8&oauth_callback_confirmed=true
D/TiAPI ( 301): (kroll$5: app://app.js) [45,55208] fn-get_request_token: config is now {"request_token_secret":"qRuy9lt3RXHSfwnjn23TGnT4uXzf7QraH9Ahoji9RB8","access_token_secret":"","oauth_version":"1.0","oauth_signature_method":"HMAC-SHA1","oauth_consumer_key":"MYCONSUMERKEY","oauth_token":"","show_login_toolbar":false,"consumer_secret":"MYCONSUMERSECRET","callback_url":"http:\/\/my.ip.address\/myapp\/twitter_callback_mobile.php","request_verifier":"lKrrw40Fus6en7BvJZKUPWEAQMaoxQ2jsdaDZJnQYE","access_token":"","request_token":"11E3y8VRGqVDj274IWUmejtEMgfUQDvblhKTe1dr0"}
D/TiAPI ( 301): (kroll$5: app://app.js) [12,55220] fn-get_request_token: callback is "org.appcelerator.titanium.kroll.KrollCallback@40883d78"
D/dalvikvm( 301): GC_CONCURRENT freed 757K, 43% free 5456K/9543K, external 926K/1038K, paused 18ms+21ms
I/ActivityManager( 62): Starting: Intent { cmp=com.myapp.mobile/org.appcelerator.titanium.TiModalActivity (has extras) } from pid 301
D/TiAPI ( 301): (kroll$5: app://app.js) [3250,58470] url is going to: http://api.twitter.com/oauth/authorize?oauth_token=11E3y8VRGqVDj274IWUmejtEMgfUQDvblhKTe1dr0
D/dalvikvm( 301): GREF has increased to 201
I/ActivityManager( 62): Displayed com.myapp.mobile/org.appcelerator.titanium.TiModalActivity: +951ms
E/Web Console( 301): TypeError: Result of expression 'b[0]' [undefined] is not an object. at http://a1.twimg.com/a/1318015544/javascripts/modules/imports/jquery.js:15
D/dalvikvm( 301): GC_CONCURRENT freed 1248K, 43% free 5496K/9543K, external 926K/1038K, paused 17ms+26ms
D/dalvikvm( 301): GC_CONCURRENT freed 1510K, 45% free 5287K/9543K, external 926K/1038K, paused 94ms+57ms
I/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [39800,98270] ============== loads 2 ==============
D/TitaniumModule( 301): (kroll$7: file:///android_asset/Resources/app.js) [1019,99289] calling timeout timer 3 @1318249748387
I/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [21,99310] ====================check status
I/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [152,99462] ============== loads 3 ==============
I/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [3,99465] listen for tokens in url
D/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [120,99585] fn-get_request_verifier: response was 51nwZdy8sv4XCj1b8ylk8GDtY88M6Z5GyuRYNLt2eIs
D/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [440,100025] fn-api: callback sent is "org.appcelerator.titanium.kroll.KrollCallback@4088afd8"
D/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [14,100039] fn-api: force authorization is false
I/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [3,100042] ----- Initializing API Request Sequence -----
D/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [4,100046] access_token is typof: string
I/TiRootActivity( 301): (main) [0,0] checkpoint, on root activity resume. context = org.appcelerator.titanium.TiContext@4073d550
D/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [194,194] fn-api: accessor is {"tokenSecret":"","consumerSecret":"MYCONSUMERSECRET"}
E/TiBaseActivity( 301): (main) [434,628] Layout cleanup.
D/dalvikvm( 301): GC_CONCURRENT freed 1219K, 45% free 5299K/9543K, external 926K/1038K, paused 19ms+39ms
D/dalvikvm( 301): GC_CONCURRENT freed 1339K, 46% free 5230K/9543K, external 926K/1038K, paused 20ms+18ms
D/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [8515,9143] the API request message: {"action":"https:\/\/api.twitter.com\/oauth\/access_token","method":"POST","parameters":[["oauth_token","11E3y8VRGqVDj274IWUmejtEMgfUQDvblhKTe1dr0"],["oauth_verifier","51nwZdy8sv4XCj1b8ylk8GDtY88M6Z5GyuRYNLt2eIs"],["oauth_consumer_key","MYCONSUMERKEY"],["oauth_signature_method","HMAC-SHA1"],["oauth_timestamp","1318249749"],["oauth_nonce","sDhBuTzTKifgUlgSGMSar7MmV3I4pli5MryKLT8fnV"],["oauth_version","1.0"],["oauth_signature","M\/0Q55bSAOqcR65mfPe\/lFtBhbw="]]}
D/TiAPI ( 301): (kroll$7: file:///android_asset/Resources/app.js) [171,9314] api url: https://api.twitter.com/oauth/access_token?oauth_token=11E3y8VRGqVDj274IWUmejtEMgfUQDvblhKTe1dr0&oauth_verifier=51nwZdy8sv4XCj1b8ylk8GDtY88M6Z5GyuRYNLt2eIs&oauth_consumer_key=MYCONSUMERKEY&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1318249749&oauth_nonce=sDhBuTzTKifgUlgSGMSar7MmV3I4pli5MryKLT8fnV&oauth_version=1.0&oauth_signature=M%2F0Q55bSAOqcR65mfPe%2FlFtBhbw%3D
D/TiHttpClient( 301): (kroll$7: file:///android_asset/Resources/app.js) [18,9332] Setting ready state to 1
I/TiHttpClient( 301): (kroll$7: file:///android_asset/Resources/app.js) [2,9334] Twitter: not sending X-Requested-With header
D/TiHttpClient( 301): (TiHttpClient-8) [1895,11229] Setting ready state to 2
D/TiHttpClient( 301): (TiHttpClient-8) [1,11230] Setting ready state to 3
D/TiHttpClient( 301): (TiHttpClient-8) [10,11240] Setting ready state to 4
W/MessageQueue( 301): Handler{408c2d50} sending message to a Handler on a dead thread
W/MessageQueue( 301): java.lang.RuntimeException: Handler{408c2d50} sending message to a Handler on a dead thread
W/MessageQueue( 301):	at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
W/MessageQueue( 301):	at android.os.Handler.sendMessageAtTime(Handler.java:457)
W/MessageQueue( 301):	at android.os.Handler.sendMessageDelayed(Handler.java:430)
W/MessageQueue( 301):	at android.os.Handler.post(Handler.java:248)
W/MessageQueue( 301):	at org.appcelerator.titanium.kroll.KrollCallback.callAsync(KrollCallback.java:162)
W/MessageQueue( 301):	at org.appcelerator.titanium.kroll.KrollCallback.callAsync(KrollCallback.java:96)
W/MessageQueue( 301):	at org.appcelerator.titanium.kroll.KrollCallback.callAsync(KrollCallback.java:91)
W/MessageQueue( 301):	at ti.modules.titanium.network.TiHTTPClient.fireCallback(TiHTTPClient.java:471)
W/MessageQueue( 301):	at ti.modules.titanium.network.TiHTTPClient.fireCallback(TiHTTPClient.java:462)
W/MessageQueue( 301):	at ti.modules.titanium.network.TiHTTPClient.setReadyState(TiHTTPClient.java:494)
W/MessageQueue( 301):	at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1013)
W/MessageQueue( 301):	at java.lang.Thread.run(Thread.java:1019)
D/SntpClient( 62): request time failed: java.net.SocketException: Address family not supported by protocol