Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Sign in with Twitter

From reading the Twitter API material, this appears to be the method needed for OAuth:
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.

— asked March 20th 2010 by Troy Taylor
  • oauth
  • signinwithtwitter
  • twitter

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:


    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!

    — answered April 19th 2011 by Joe iEntry
    1 Comment
    • Joe, this is a fantastic library. Thank you so much for sharing.

      — commented August 23rd 2011 by Jim Carter III
  • 10 lines of code with the OAuth Adapter:

    var oAuthAdapter = new OAuthAdapter(
    // load the access token for the service (if previously saved)
    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
            // save the access token
        // 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);
    — answered July 2nd 2010 by David Riccitelli
    1 Comment
    • But how does this work with a user's credentials? Still hoping they add a real example to Kitchen Sink 1.4.

      — commented July 2nd 2010 by Troy Taylor
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.