graulund/tweetnest — pull request #42 by alexmuller (2012-08-22 14:15:42+00:00)
Title: Integrate Tweet Nest with abraham's twitteroauth library

Hi Andy!

I love Tweet Nest, thanks so much for creating it.

Given [Twitter's recent developer news][twitterdev] about authentication being required, I thought I'd try and add OAuth into Tweet Nest.

[twitterdev]: https://dev.twitter.com/blog/changes-coming-to-twitter-api

I saw in a few issues and pull requests that you didn't want to do this because of setup complexity - but it now definitely needs to happen, as far as I can tell.

The code is in `alexmuller/tweetnest` on a branch called `oauth-integration`. Obviously it will need some fixes and tweaks before it's included (I may have butchered it a little), but it's working pretty well for me and some friends. A couple of points:

1. abraham's twitteroauth library doesn't do the same 64-bit checks before json_decode that you do. This may break 32-bit systems?
2. I've tried my best to figure out how you're determining the user, and I think I've been consistent. But perhaps not.
3. I'm not sure that favourites fetching is working perfectly, with the array called `$p` that I'm using for Twitter request parameters.

Creating a new install should just work. For migrating installs:

1. Pull the new code
2. Run the migration in `/upgrade/upgrade.20120820.php`
3. Add new Twitter application settings in `/inc/config.php`:

'consumer_key' => 'xxxxxxxx',
'consumer_secret' => 'xxxxxxxxxxxx',
'twitter_callback' => 'http://foo.foo/tweetnest/maintenance/oauth_callback.php',

4. Visit `/maintenance/oauth_redirect.php` to load your OAuth credentials into the DB
5. Grab your tweets as normal!

And you're up and running! Obviously take a backup before messing around.

I know it's a lot of code to dump in one pull request, but I thought I'd put it here in case it's useful to anyone else.

Cheers,

Alex