Twitter authentication in kitchen sink
Now that Basic Auth for twitter is going away, is someone working on an example to use oAuth?
3 Answers
-
Yeah I really need an oAuth example too.. Thanks
-
10 lines of code with the OAuth Adapter:
var 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); }
-
BirdHouse: Twitter OAuth for Android & iPhone
BirdHouse has been tested on Android with Linux and Mac as well as on iPhone, both using the latest Titanium Mobile SDK (1.6.2). It has been tested by others and is being maintained to fix any issues.
Go here for the code and go here for the test app.
David Riccitelli's oauth-adapter doesn't work on Android, but some have forked it to work with Android, such as Ketan Majmudar (go here for his code), but I have been more successful with BirdHouse.