Sign in with Twitter
From reading the Twitter API material, this appears to be the method needed for OAuth:
http://apiwiki.twitter.com/Sign-in-with-Twitter
which seems very similar to the method currently used in the Kitchen Sink Facebook example. Does anyone have code that uses this? I'm trying to setup the ability to RT tweets that I already have pulled using strings I've already had the user set as their Twitter sign in username and password.
2 Answers
-
Check out BirdHouse, a Twitter OAuth script. You can see the code here and you can go here for the test app.
You can use the get_tweets function, print those to a table, attach an event listener to the table so that when a person clicks on a tweet you can open the tweet dialog by doing something like:
table.addEventListener('click',function(e){ BH.tweet(e.row.title); });
That will open the tweet dialog with the tweet as the default text (assuming you aren't using a label to put the tweet in the row, if you want to use labels you will have to get fancier in your event listener).
I'm not sure if this constitutes as a "re-tweet", but the api function is there for you to make custom API calls. If you have any questions or issues with the code, feel free to contact me on GitHub!
-
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); }