passcod/mtwitter — pull request #4 by freynolds (2013-03-18 20:53:04+00:00)
Title: App Auth Only

added app only authentication url & methods to get bearer token
added access to resources via bearer token.

Example:
mtwitter called with no bearer token. appAuth will get the token and insert it for next requests.
I've made the search inside of the callback because of the async nature of get the appAuth.
```javascript
var twt = new twitter({
consumer_key: config.key,
consumer_secret: config.secret,
application_only: true
})
.appAuth(function (err, data) {
if (err) {
console.log(err);
return;
}
console.log(data);
twt.search("test", {count: 100}, function (err, data) {
if (err) {
console.log(err);
return;
}
console.log(data);
});
});
```

Case you initialize the mtwitter app with the bearer token and use it after to make calls from anywhere.
```javascript
var twt = new twitter({
consumer_key: config.key,
consumer_secret: config.secret,
application_only: true,
bearer_token: config.bearer_token
})
.search("test", {count: 100}, function (err, data) {
if (err) {
console.log(err);
return;
}
console.log(data);
});
```