Titanium Community Questions & Answer Archive

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

Twitter authentication in kitchen sink

Now that Basic Auth for twitter is going away, is someone working on an example to use oAuth?

— asked May 1st 2010 by Prem Pillai
  • auth
  • twitter

3 Answers

  • Yeah I really need an oAuth example too.. Thanks

    — answered May 3rd 2010 by Ross Waycaster
  • 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
    • Hi David - I'm trying to implement your code above and getting the following error. Do you see anything obvious in my code snippet (which is exactly as you have it)? Thanks for any assistance.

      Error: [ERROR] Syntax Error = Parse error at oauth.js (line 110)

      Code Snippet: http://pastie.org/1687637

      — commented March 18th 2011 by Rodney Fickas
  • 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.

    — answered April 19th 2011 by Joe iEntry
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.