|
UsageManualR4
How to use the OAuthAdapter release 4.
Phase-Deploy IntroductionThis short introduction will explain how to use the OAuthAdapter. Download the oauth_adapter.js file according to your version of Titanium Mobile SDK and iPhone SDK:
You need to download the following two libraries to a lib subfolder (below the Resource folder) in your project: Then download the oauth_adapter.js in any folder you like and include it via Ti.include('oauth_adapter.js'). Detailsvar oAuthAdapter = new OAuthAdapter(
'<your-consumer-secret>',
'<your-consumer-key>',
'HMAC-SHA1');
// load the access token for the service (if previously saved)
oAuthAdapter.loadAccessToken('twitter');
oAuthAdapter.send('https://api.twitter.com/1/statuses/update.json', [['status', 'hey @ziodave, I successfully tested the #oauth adapter with #twitter and @appcelerator #titanium!']], 'Twitter', 'Published.', 'Not published.');
// if the client is not authorized, ask for authorization. the previous tweet will be sent automatically after authorization
if (oAuthAdapter.isAuthorized() == false)
{
// this function will be called as soon as the application is authorized
var receivePin = function() {
// get the access token with the provided pin/oauth_verifier
oAuthAdapter.getAccessToken('http://twitter.com/oauth/access_token');
// save the access token
oAuthAdapter.saveAccessToken('twitter');
};
// show the authorization UI and call back the receive PIN function
oAuthAdapter.showAuthorizeUI('http://twitter.com/oauth/authorize?oauth_token=' +
oAuthAdapter.getRequestToken('http://twitter.com/oauth/request_token', [['oauth_callback', 'oob']]),
receivePin, PinFinder.twitter);
}
|
► Sign in to add a comment
Do we need to include something like:
Ti.include('lib/oauth_adapter.js');
Using the code I get to the authorization screen, I enter the credentials and press "yes" to authorize. Then the window closes and the app crashes. Sometimes before the app crashing I get to see the "code". What am I doing wrong?
Same problem for me on an iPad app, using TI 3.1.2 and R4.
Most times the application will simply exit without throwing an error, but when it does throw an error it is as seen at:
http://pastie.org/1031109
Hope this helps.
Jim
Update: This also happens on an iPhone App, TI: 3.1.2, R4, iOS4
Hi vpapakonstantinou,
The simulator might crash before of the following issue: app-crash-on-textarea-in-13-with-error-webtrythreadlock
Let me know if it's the one you're experiencing.
Hi jspearson,
Try the sample iPad app here: http://bit.ly/cfLTRa. You might want to adjust width and height of the Authorization UI.
David
This gets as far as showAuthorizeUI and that results in the twitter 404 page. Anybody else having the same problem?
Hi Larrence,
Thanks for trying out the oAuth Adapter. According to this log line, you didn't set your consumer key and secret. Remember to get them from Twitter: INFO? Creating a message [{"action":"http://twitter.com/oauth/request_token","method":"POST","parameters":[["oauth_consumer_key","<my consumer key>"],["oauth_signature_method","HMAC-SHA1"],["oauth_callback","oob"]]}]: done.
David
Actually I did, but I changed that line because I didn't want to post it here. I will look into it further. Thanks David.
Is it possible to use it with Facebook?
Hi Therium, hadn't got the chance to test it with Facebook.
I found a bug in the newest release, when I want to sign in with Twitter the webView opens, then when I start to type the keyboard slides up and all the views behind the webView also slideup.
The crash with -setHref:?: unrecognized selector sent to instance 0x7d5a820 also happens to me
if you're using iPhone SDK 4, there's a bug with the WebView? trying to recognize the phone numbers in the web page and crashing.
R14 of the OAuth Adapter disables this behaviour, you can get it here:
Let me know if it helps
Got it. The crash is caused by some bug, that happens during the redirect of webView (has nothing to do with callbacks, it's a pure appcelerator bug). If you upgrade appcelerator to the next version (1.3.2), the crash problem simply disappears
To ziodave: indeed, I was using SDK 4.0 and appcelerator 1.3.0, and it was crashing. But I was ALREADY using the version R14, I think (this one: http://oauth-adapter.googlecode.com/svn-history/r14/trunk/oauth_adapter.js). Anyway it was crashing, and as much as I could tell, it was crashing in the moment of redirect by twitter (maybe they use some special redirect?)
Upgrade to 1.3.2 resolved the crash problem.
When I sign in and want to tweet I always get "Tweet not published". With R4 this problem didn't occur.
Can you please always state which version of Titanium Mobile SDK and iPhone SDK are you using?
I found the problem, in the newest example you have: ['status': 'text'] but it must be [['status': 'text']]. That did the trick.
Thanks, fixed in R16
http://oauth-adapter.googlecode.com/svn-history/r16/trunk/oauth_adapter.js
Please, I am quite new to twitter, how am I supposed to do sign out?
There is not sign-out in OAuth processes. The user can de-authorize the access-code via the service pages. You don't need to implement anything for sign-out.
I do need to sign out to be able to relogin as a different user.
However I did figure it out:
oAuthAdapter.send("https://api.twitter.com/1/account/end_session.json",[],"Twitter", "Signed out!","Failed to sign out!");
Yep, that's good :-)
One more thing, it's something simple, but I would suggest to let the user disable the error and success alerts (when empty text is passed, for example, no need to show empty alert). Just in many (if not most) cases the application has its own method of error-processing.
Has anyone gotten this running on the Android emulator? I'm trying it and always see the Twitter 404 page. I'm assuming this is due to not receiving anything back from getRequestToken()... I see the debug message "request token got the following response: " with no value for client.responseText.
So as a first step I've been trying to get just getRequestToken() to work, with no luck - I tried both the https and http URLs for api.twitter.com/oauth/request_token, but same result in both cases, no data and client.status returning 0.
Any clues? My next step is to try through a network monitoring proxy to see exactly what's being generated, but I figured I'd ask here to see if anyone had had success with this first.
OK, network proxy shows me that I'm getting a 401 Unathorized back from Twitter - so there's apparently something wrong with the Android/Titanium HTTPClient in that it's returning 0 for status. I'll raise that with the Titanium guys.
As for the OAuth stuff, my request looks like this:
-- BEGIN
POST /oauth/request_token HTTP/1.1 X-Requested-With: XMLHttpRequest User-Agent: Length: 76.0 Content-Length: 994 Content-Type: multipart/form-data; boundary=cbYfn0CWb2kprbwOkAbL1iJfS10jkCpWIyrC Host: api.twitter.com:7667 Connection: Keep-Alive
--cbYfn0CWb2kprbwOkAbL1iJfS10jkCpWIyrC Content-Disposition: form-data; name="oauth_signature" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
UQc+zoYzZfMGg9y8IHZ7aB+p/gU= --cbYfn0CWb2kprbwOkAbL1iJfS10jkCpWIyrC Content-Disposition: form-data; name="oauth_nonce" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
sRxe7D --cbYfn0CWb2kprbwOkAbL1iJfS10jkCpWIyrC Content-Disposition: form-data; name="oauth_consumer_key" <...etc...>
-- END
Does this look right? I'm new to OAuth, so am wondering if indeed the consumer_key, nonce, etc, should be sent as multipart-form-data...?
(thanks in advance for any tips/advice!)
I cannot get this to work...I keep getting expressionBeginOffset = 2735; expressionCaretOffset = 2744; expressionEndOffset = 2744; line = 120; message = "Can't find variable: PinFinder?"; name = ReferenceError?; sourceId = 260345336; sourceURL = "file://localhost/Users/HD/Library/Application%20Support/iPhone%20Simulator/4.0/Applications/9CEE1941-7D1E-48EC-8DD9-778B12D1C74E/twitter.app/result.js"; } Any ideas??
@mfsmillie, if you're using R16 you need to remove the reference to PinFinder?, look at the docs inside the .js file, not on this page.
However, having done that myself it crashes the app when it tried to authorise (the broswer briefly ends up at what looks like a 404 page sometimes, before it crashes.
Should have added, I'm using Mobile SDK 1.4.0/1 and iPhone SDK 4.0.
same Error that s.w.harris have.
I'm using Mobile SDK 1.4.0 and iPhone SDK 4.0
Any help?
Here is the Solution:
Edit the Line:
In:
oAuthAdapter.showAuthorizeUI('http://twitter.com/oauth/authorize?' +
Thats all an it works for me
I get this error message when use oauth_adapter_r16
And when debug, I see this error occur due to
Because file .config exists, but its content is null, so my program cannot read config of this contents.
I'm using Mobile SDK 1.4.0 and iPhone SDK 4.0.
Anyone can help me?
does this work with android? are there major conflicts if we us it on android?
Using Mobile SDK 1.4.1 and iPhone SDK 4.0 having problems with my apps crash after the oAuth popups shows.
After some debugging I found that the problem is with:
var xmlDocument = Ti.XML.parseString(e.source.html);
in the authorizeUICallback function.
Terminating app due to uncaught exception 'org.sometestapp.TiDOMDocumentProxy', reason: 'Error Domain=com.google.GDataXML Code=-1 "The operation couldn’t be completed. (com.google.GDataXML error -1.)". in -parseString:? (TiDOMDocumentProxy.m:50)'
how to get the home_timeline ? I'm not good with JS so please someone help me .
I am seeing the same eeror as @jeroen.van.wissen After the oAuth Pop shows up, the app crashes.
Any tips
I'm in the same boat as @AdemarTutor? and g...@thoughtcraft.com - can someone recommend some way to get this working with Android? I'm getting the 404 error page from Twitter also. What needs to be changed in the adapter or in the Titanium SDK to get this working for Android? I noticed X-Request-Header is not being set for twitter.com in the SDK.
I have the same problem as well, it opens up a 404 and then crashed. Anybody has an answer would greatly be appreciated :)
Ahh ok my bad, followed @carlsspace solution and it worked.
But I have another problem, it doesn't seem to work with GET. I'm trying to call statuses/home_timeline and it's not working, it says 401 and the connectionType is still POST no matter what I do :(
wow, just found this and it looks awesome...is this solely for twitter? i'm trying to add dropbox functionality to my ipad app and have been looking for an oauth solution. not really familiar with this or oauth enough to know if i can tweak it for dropbox. can anyone tell me if its possible? thx!
@carlsspace solution works perfectly for posting. everyone refer to that who is having problems with the "404 app crash" bug
I'm using this to connect with the FreshBooks? api... buggy since it only supports twitter but I'm making progress.
FreshBooks? requires that the oauth_callback be explicitly set... anyone have any ideas on how to handle this since freshbooks passes a oauth_verifier and oauth_token parameter to the callback url?
Also, there is no "pin" with FreshBooks?... just show the login view for user to input freshbooks username/pw on the FB server
I've been able to get the oauth verification to work with FreshBooks?.. anyone have any idea how to post XML with this library?
Hi, I've finally managed to have it work in my titanium project, but i'm wondering one thing : how can I retreive the username ? I'd like to display the user time line, but I can't grab the username specified during the registration process. I've tried with a listener set on the webview, parsing the DOM while the user is entering it, but it's not working.. Did I missed something ?
Here are some bugfixes. This makes it compatible with the SDK 1.4.1.1 and above. In addition, this fixes the problem of non-compliant XML from Twitter. http://pastie.org/1297119
This worked for me:
Ti.include("oauth_adapter.js");
var oAuthAdapter = new OAuthAdapter(
oAuthAdapter.loadAccessToken('twitter');
//oAuthAdapter.send('https://api.twitter.com/1/statuses/update.json', [['status', 'Test :)']], 'Twitter', 'Published.', 'Not published.'); if (oAuthAdapter.isAuthorized() == false)
}it was working but now i keep getting "Sorry,that page doesn't exist" what is wrong ???
Same issue here.
thanks @planetabinari worked just fine
Wondering too, also getting "Sorry, that page doesn't exist". So many different versions out there now of the oauthadapter code and the integration code. If someone could just make one "this is the official latest working version"-doc that would be super-awesome! :)
This definitely doesn't work with Titanium SDK 1.5.0. I just ran it with Titanium SDK 1.4.2 and it worked. Getting the 404 "Sorry this page doesn't exist" page from Twitter and then my app crashes with 1.5.0. Looks like a change Titanium made causes this to break.
Same problem here, stopped working with Titanium SDK 1.5.0 Any solutions?
How it worked for me with Titanium 1.2x and up
That's about it!
I run Titanium 1.2.1 against iPhone SDK 3.1.2 or so. Still need to update to Snowleopard for SDK 4 support :)
For another app 'Shoudio - location based audio recordings' I do the oauth stuff by having an intermediate usersystem on the mobile site and doing the FB & Twitter oauth connections through a webview
How it stopped working for me with Titanium 1.5.0 / 1.5.1 and up
When I test on the laptop against Titanium 1.2.x it works, but on an iOS4 device with Titanium 1.5.1 Twitter keeps returning the 'that page does not exist'
Same problem as reported by ali, sergej & aksenovdm
Here is how I got it working with Titanium 1.5.1
Ok so here we go: I have Titanium 1.5.1 running against a iPhone SDK 3.1.x.
At first I also got the '404 page not found at Twitter' and some other errors, but with this current setup it all started working magically:
I use the following code block to call the Twitter API:
Ti.include('lib/oauth_adapter.js'); var oAuthAdapter = new OAuthAdapter( 'YOUR_CONSUMER_SECRET_HERE', 'YOUR CONSUMER KEY HERE', 'HMAC-SHA1'); // load the access token for the service (if previously saved) oAuthAdapter.loadAccessToken('twitter'); oAuthAdapter.loadAccessToken('twitter'); oAuthAdapter.send('https://api.twitter.com/1/statuses/update.json', [['status', '@shoudio retoric testing is epic. This random number too right? '+Math.random()]], 'Twitter', 'Published.', 'Not published.'); if (oAuthAdapter.isAuthorized() == false) { // this function will be called as soon as the application is authorized var receivePin = function() { // get the access token with the provided pin/oauth_verifier oAuthAdapter.getAccessToken('https://api.twitter.com/oauth/access_token'); // save the access token oAuthAdapter.saveAccessToken('twitter'); }; // show the authorization UI and call back the receive PIN function oAuthAdapter.showAuthorizeUI('https://api.twitter.com/oauth/authorize?' + oAuthAdapter.getRequestToken('https://api.twitter.com/oauth/request_token'), receivePin); }As you might notice in the code block above I added a 'Math.random()' to the test Tweet to post, because otherwise after one test, you will get the 'Not published' error, because you are sending out duplicate tweets.
I hope this helps somebody. I will implement this in V2 of Shoudio
How to post an image as a tweet using this code.
I am not getting a button to close in the appeared twitter ui. If i want to go back on my previous window what should i do??
Cannot get the close button in 1.5.1, any solution availabale for that?
I am running into a '404 page not found' error when trying to authenticate on Titanium 1.5.1 running against Android APIs 2.2. Seems that oAuthAdapter.getRequestToken is not returning a token but rather an massage saying the request was not valid.
Does anyone have a workaround or solution?
Thanks in advance for your help. Kelvin
There are a fair number of issues with Titanium and Android, but I was able to get it working on 1.5.1. I can post a diff later, but essentially this is what I found:
@maki.mik do you think you could post your solution? I' am having the same problems and getting this to work in android is the last thing I need to do for my app...
@maki.mik great catch! hi @ghes, hope this helpes. http://www.exilis.org/uploads/0001-now-it-runs-on-Android.patch This is a patch for https://github.com/mogya/tm_twitter_api .
Thanks @exi that was exactly what I was looking for!
@ges It seems there are bugs in my code. I'll submit another patch later...
@ exilis, I tryed your patch for android,but seems did not work,do you know how to fix? Any help would be greatly appreciated.
I'm going to submit a new patch soon, but here is a list of fixes, just in case.
Thanks, @exi, for your work here. Do you know if the evalJS() fix is supposed to be in 1.5.2?
Just wanted to post some thanks for a great script.
I did notice that while the twitter oauth works completely fine with Titanium 1.6 and iOS 4.0 SDK, while trying the exact same code on Titanium 1.6 and iOS 3.2 SDK, I kept getting "Tweet not published" alerts.
Am I missing something to get it to work in 3.2? Or do you think that the changes in Titanium 1.6 Mobile SDK has broken it?
I have this working with some of the suggestions in Titanium 1.6 and ios 3.2 and above. One thing I am looking at is if you decide not to authorize the app via the twitter authorization page it doesn't close so your app is left with a hanging webview.
@grantmar Yes, you are right, window.hide() doesn't seem to work by some reason, but I found that setting .visible property works as a workaround. However, it crashes the process in another case... Another option is calling window.close() and which works as we expect, but the implication here is your callback function will never be called. I haven't have a chance to look into Titanium's code yet, but I would say this should be done by fixing Titanium side rather than patching oauth-adapter's interfaces.
http://bit.ly/fB41H7
Here is a link to my latest patch as just for your reference, but as I mentioned above, it has a problem of missing callback after showing the auth-ui. I haven't sent this patch to @mogya yet because I couldn't spend enough time for testing it past few days, and I'm going to be busy until March 6 for attending GDC. Thanks
I'm trying to run the oauth-adapter with no success. I have the following in my code http://pastebin.com/s8AJd3fg and I get this errors http://pastebin.com/xDA3JF2a when trying to send tweet.
When I click the button to send the tweet, I get to the authorizing window, after that I submit password and username, then it says authorization completed and it sends me to the webpage that I specify on developer.twitter.com, when it's loading the webpage the app crashes with the error http://pastebin.com/s8AJd3fg
Solved.. On Applications Settings in developer.twitter.com the Application Type has to be Client
So, there is no response being returned and when the UI opens it goes to a Twitter page saying "page not found" or the like.
Dear exilis, etc --
Just started following this thread. I am building an Android app using Appcelerator and would love to be able to use this OAuth adapter code. I worked through exilis' diffs (last one here: http://bit.ly/fB41H7) and still get the page not found error in my app.
Did anyone else get this to work on Android yet? And if so, would you mind posting the Android js implementation to this site? .js file much preferred over simple diffs if possible!
thanks all, appreciate your help, JB
I have tried with this one :
https://github.com/stereoket/oauth-adapter
But still I have That page doesn't exist.
But in LogCat? I can see that :
04-08 14:36:15.139: DEBUG/TiAPI(30278): (kroll$6: app://jobs_details.js) [2,24602] oauth_token=a_token&oauth_token_secret=a_different_token&oauth_callback_confirmed=true
I get 2 errors when posting the tweets.
Well the posing works, but I don't get the 'Close' button on the screen. Also when I click 'Deny' instead of 'Allow' i get redirected to a page (where i need the close button to close it, so I can't close it). When I click on a hyperlink on that page the app crashes also.
Has anyone had these problems too? I'm using Titanium SDK 1.6., iPhone SDK 4.2 and R16 of oauth.
Thanks!
Has anyone definitively figured out the "this page doesn't exist" problem when running on a real device? I have this working perfectly in the iOS simulator under 4.3 or 4.2, but a 4.2 device(all i have to test with) shows the "does not exist" page instead of the login page.
Clueless...
Does anyones app crash with the new twitter authentication screen layout? Mine crashes on the moment it opens..
Any advice?
my app was just denied by the app store peeps because of twitter bug. Thing is, it looks like the twitter auth screen changed. I have an app with the exact same code that was working perfectly and was approved. Right before I submitted my new app to the app store things were great. I got a notice from them saying it was not working and that twitter was asking the user to write down a pin number. Did something change with twitter?
@jgreg yes it seems that the PIN is now in a code element, https://github.com/stereoket/oauth-adapter has the change, he just parses the document HTML with a regex.
I've made my own version of this which works on Android, I hope to have the time to post it soon.
Everytime i try twitter using the following code:
I get the following error:
INFO? INFO? If you like the OAuth Adapter, consider donating at INFO? https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=T5HUU4J5EQTJU&lc=IT&item_name=OAuth%20Adapter¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted INFO? Entity: line 18: parser error : Opening and ending tag mismatch: link line 7 and head </head><body class="tfw en logged-out oauth write "> ^ Entity: line 44: parser error : Opening and ending tag mismatch: img line 42 and h3 </h3> ^ Entity: line 51: parser error : Opening and ending tag mismatch: h3 line 41 and div </div> ^ Entity: line 71: parser error : Opening and ending tag mismatch: input line 71 and div city_token" type="hidden" value="YOU KNOW"></div ^ Entity: line 80: parser error : Opening and ending tag mismatch: input line 79 and span </span> ^ Entity: line 81: parser error : Opening and ending tag mismatch: span line 78 and div </div> ^ Entity: line 87: parser error : Opening and ending tag mismatch: input line 86 and span </span> ^ Entity: line 88: parser error : Opening and ending tag mismatch: span line 85 and div </div> ^ Entity: line 89: parser error : Opening and ending tag mismatch: div line 83 and fieldset </fieldset> ^ Entity: line 99: parser error : Opening and ending tag mismatch: input line 98 and fieldset </fieldset> ^ Entity: line 100: parser error : Opening and ending tag mismatch: input line 97 and form </form> ^ Entity: line 111: parser error : Opening and ending tag mismatch: fieldset line 95 and div </div> ^ Entity: line 160: parser error : xmlParseEntityRef: no name window.pageTracker && window.pageTracker.trackPageview('/oauth/approved/Can ^ Entity: line 160: parser error : xmlParseEntityRef: no name window.pageTracker && window.pageTracker.trackPageview('/oauth/approved/Can ^ Entity: line 164: parser error : xmlParseEntityRef: no name window.pageTracker && window.pageTracker.trackPageview('/oauth/declined/Can ^ Entity: line 164: parser error : xmlParseEntityRef: no name window.pageTracker && window.pageTracker.trackPageview('/oauth/declined/Can ^ Entity: line 173: parser error : StartTag?: invalid element name if(window.innerHeight < $('#bd').height()+160) { ^ Entity: line 209: parser error : Opening and ending tag mismatch: fieldset line 74 and body </body></html> ^ Entity: line 209: parser error : Opening and ending tag mismatch: input line 73 and html </body></html> ^ Entity: line 209: parser error : Premature end of data in tag div line 71 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag form line 71 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag div line 40 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag div line 36 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag div line 29 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag body line 18 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag link line 6 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag meta line 4 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag meta line 3 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag head line 1 </body></html> ^ Entity: line 209: parser error : Premature end of data in tag html line 1 </body></html> ^ ERROR? Error Domain=com.google.GDataXML Code=-1 "The operation couldn’t be completed. (com.google.GDataXML error -1.)". in -parseString:? (TiDOMDocumentProxy.m:50) ERROR? The application has crashed with an unhandled exception. Stack trace:
Any ideas?
Apparently i get the error above when i reach to this line
Does it means the twitter html is not valid? What should I do?
Thanks
Seems like the process has changed on Twitter's end, but no update on the documentation..
Even, im getting parser error!! any fix for this?
Hi, a very ugly workaround, but it worked for me.
In oauth_adapter.js remove authorizeUICallback (should be at line 226) with the following lines:
I had an issue where I've got a hybrid app (browser and client) so to make it work I had to set my twitter profile to Browser but that was breaking the app (not really breaking just not working) .. So I edited the authorizeUICallback... Here is my change just in case someone else runs into this problem... `// looks for the PIN everytime the user clicks on the WebView? to authorize the APP
And how to do work with Google i mean Docs, Gmail, Mail and so on. I have only my Email and password, so how to authenticate thru my google account. There are similar tutorial http://mobile.tutsplus.com/tutorials/appcelerator/titanium-user-authentication/ like i say just with google account. Thanks for advance. P.S. sorry for my poor English xD
Fixes to the fix on 30th May that handle bad authorisation attempts:
var authorizeUICallback = function(e) { Ti.API.debug('authorizeUILoaded'); Ti.API.debug('Url:'+ e.url ); if( e.url.indexOf( 'https://api.twitter.com/oauth/authorize?' ) == -1 ) { //Ti.API.debug('HTML:' + e.source.html); var positionStart = e.source.html.indexOf( '<code>' ); var positionEnd = e.source.html.indexOf( '</code>' ); if( positionStart != -1 && positionEnd != -1) { pin = e.source.html.substring( positionStart + 6, positionEnd ); Ti.API.debug( "pin: " + pin ); if (receivePinCallback) setTimeout(receivePinCallback, 100); destroyAuthorizeUI(); } nodeList = null; xmlDocument = null; } };Also had to change line 197 from window.hide() to window.close();
Works great now.
Works fine now !
Real thank cyblob u're the "TitatwitGod?".
Anyone getting this error from Twitter when the auth UI window appears?
"Whoa there! The request token for this page is invalid. It may have already been used, or expired because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake"
Thanks cyblob!
I've made the changes illustrated by cyblob and it's working on iOS but when I've tried this on Android I got:
Whoa there! There is no request token for this page. That's the special key we need from applications asking to use your Twitter account. Please go back to the site or application that sent you here and try again; it was probably just a mistake.
Anyone else getting this error?
If anyone is getting trouble with the pin, and an XML parsing error... Replace the function with this one... I had to re-make it using regular expressions...
var authorizeUICallback = function(e)
id = null; node = null;
destroyAuthorizeUI();
};