0

I had a small web app that was using the Twitter API 1.0 user_timeline function to quickly get a user's recent tweets without authentication. However, now every call requires oAuth which I'm terrible at. I know there's an application only authentication method, which is what I want since this is an automated app and not a user based one.

The application was built in node.js so a suggestion for a module that supports app-based oAuth would be great. The main thing is I don't have nor need a callback page, which most assume, since all I'm trying to do is get the last few tweets from a handful of specific Twitter accounts which the app tracks. Likewise any links to good oAuth educational resources or, better yet, Twitter 1.1 HTTP request walkthroughs would be much appreciated.

Thank you for your time.

4

2 回答 2

4

Twitter API 1.1 allows only authenticated requests. But the good news is that the oAuth based authentication is not that difficult. To use it:

  1. Generate the four oAuth keys you need. Go to https://dev.twitter.com/apps/new and register your app.
  2. Install package ntwitter on your machine.
  3. Configure the four keys in your app. See the package page on how to do it.
  4. Construct request and get results. See this page on how to make requests.

I find oAuth to be easier and prefer this way.

于 2013-06-14T18:36:37.873 回答
1

The package EveryAuth does authentication pretty well, too. Also, ntwitter isn't being updated very regularly right now; I found mtwitter to be much better. I suck at explaining stuff, so I'll just show you how I did it:

            var mtwitter = require('mtwitter');

            var twit = new mtwitter({
                consumer_key: { your app consumer key },
                consumer_secret: { your app consumer secret },
                access_token_key: { get this from oauth or everyauth or whatever },
                access_token_secret: { get this from oauth or everyauth or whatever }
            });

            twit.get('/statuses/user_timeline', { include_entities: true },
                function (err, data) {
                    if (err) {
                        console.log(err.toString());
                    }
                    else console.log(JSON.stringify(data));
            });
于 2013-06-24T23:15:28.847 回答