How to authenticate a HTTP request with oAuth for the Twitter API

You must Login before you can answer or comment on any questions.

Hi folks,

I need to update my app due to Twitter's API changes from v1 to v1.1

Hopefully something simple, but the request I usually perform now requires authentication.

Any suggestions how I can alter this snippet to authenticate in the HTTP request?

// Create our HTTP Client
    var loader = Ti.Network.createHTTPClient({
            timeout : 30000
        });
    // Sets the HTTP request method, and the URL to get data from
    loader.open("GET", "https://api.twitter.com/1/lists/statuses.json?slug=journo-tweets&owner_screen_name=transferwin&per_page=10&include_entities=true");

Many thanks!

Simon

— asked 1 year ago by Simon Hume
3 Comments
  • Thats odd. I just pasted your url into my browser (no authentication) and retrieved the JSON block just fine!

    — commented 1 year ago by Nick Milner

  • you do in the browser, try and run that through an HTTP request and it just runs forever! Replace 1 in the URL with 1.1 and you'll see the difference

    — commented 1 year ago by Simon Hume

  • Ah, sorry. You need to use an OAuth client to process the twitter requests then. Try looking here

    http://developer.appcelerator.com/question/19961/twitter-oauth

    — commented 1 year ago by Nick Milner

1 Answer

Hi Simon,

please look to this Module from Marcel. It works perfect for me. In this github also special moduels for twitter and facebook. If you want to use the older variant you can use jsoauth from Griffith or birdhouse. Google is your friend.

Rainer

Your Answer

Think you can help? Login to answer this question!