// This is an example of use. // Here we use the new Bearer Token thats make it possible to get tweets without user login // More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth // Full Codebird API is here: https://github.com/mynetx/codebird-js var Codebird = require("codebird"); var cb = new Codebird(); cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY'); var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null); if(bearerToken == null){ cb.__call( 'oauth2_token', {}, function (reply) { var bearer_token = reply.access_token; cb.setBearerToken(bearer_token); Ti.App.Properties.setString('TwitterBearerToken', bearer_token); fetchTwitter(); } ); } else { Ti.API.info("We do have a bearer token..."); cb.setBearerToken(bearerToken); fetchTwitter(); } function fetchTwitter(){ cb.__call( 'search_tweets', "q="+Ti.Network.encodeURIComponent("#awesome"), function (reply) { // ... Ti.API.info(reply); }, true // this parameter required ); }