Unable to authenticate with consumerkey and consumer secret!


#1

Unable to authenticate with consumer key and consumer secret, using the correct credentials.


#2
(function() { var RUN_TESTS = false;

if (RUN_TESTS) {
Ti.include(‘tests/tests.js’);
} else {
var accessTokenKey = Ti.App.Properties.getString(‘twitterAccessTokenKey’),
accessTokenSecret = Ti.App.Properties.getString(‘twitterAccessTokenSecret’);

var Twitter = require('twitter').Twitter;

var client = Twitter({
  consumerKey: "ba9df9055c77f338",
  consumerSecret: "846ffe1ec3b18989e73fe7fff833",
  accessTokenKey: accessTokenKey, 
  accessTokenSecret: accessTokenSecret
});

var win = Ti.UI.createWindow({backgroundColor: 'white'}),
    tableView = Ti.UI.createTableView();

win.add(tableView);
win.open();
  
client.authorize();

client.addEventListener('login', function(e) {
  if (e.success) {
    Ti.App.Properties.setString('twitterAccessTokenKey', e.accessTokenKey);
    Ti.App.Properties.setString('twitterAccessTokenSecret', e.accessTokenSecret);
    
    client.request("1/statuses/home_timeline.json", {count: 100}, 'GET', function(e) {
      if (e.success) {
        var json = JSON.parse(e.result.text), 
            tweets = json.map(function(tweet) {
              return {title: tweet.text};
            });
        
        tableView.setData(tweets);
      } else  {
        alert(e.error);
      }
    });
  } else {
    alert(e.error);
  }
});

}
})(this);