Tropical Software Observations

07 July 2010

Posted by Unknown

at 11:13 AM

0 comments

Labels: ,

Android: Twitter4j with xauth

The latest Twitter4j 2.1.3 supports xauth but it's not well documented at the moment. However it's really simple to use, check it out!



// Specify the consumer key and consumer secret 
// via system properties or configurationbuilder

System.setProperty("twitter4j.oauth.consumerKey",TWITTER_CONSUMER);
System.setProperty("twitter4j.oauth.consumerSecret",TWITTER_SECRET); 



// Then authenticate as normal
Twitter twitter = new TwitterFactory().getInstance(username,
password);



// Next the token will be available to you
AccessToken token = twitter.getOAuthAccessToken();


// You must store the access token and reuse this token
twitter.setOAuthAccessToken(token);


0 comments: