views:

684

answers:

2

Hi Folks,

I am working on the Twitter Authentication. The Basic Authentication will expire on August 16th onwards. So we have to use OAuth to use Twitter Authentication. But Its some Complicated to implement. XAuth is cuts off the two steps. But the Problem is i used Twitter4j to authenticate.And also had bad documentation too. I want to use XAuth from 1.6 itself. Which package you suggest to use. and If any example or tutorial for specifiacally for Android to use XAuth Authentication.

+2  A: 

EDIT: In my code I did this:

System.setProperty("twitter4j.oauth.consumerKey", "your token");
System.setProperty("twitter4j.oauth.consumerSecret", "your token secret");

Twitter twitter = new TwitterFactory().getInstance(login, password);

AccessToken accessToken = twitter.getOAuthAccessToken();

Then you must save your Token and Token secret from AccesToken

if (mAccessToken != null) {
    if (mAccessToken.getToken() != null && mAccessToken.getTokenSecret() != null) {
        saveAccessToken(mAccessToken.getToken(), mAccessToken.getTokenSecret());
    }
}

When you want to use your Token you just do this:

TwitterFactory factory = new TwitterFactory();
Twitter twitter = factory.getInstance();
twitter.setOAuthConsumer("[consumer key]", "[consumer secret]");
AccessToken accessToken = loadAccessToken();
twitter.setOAuthAccessToken(accessToken);
pixel
@pixel: These thinks are all i found in the twitter4j official site itself. Its getting the NullPointerException at the Second Time. And also in that site supports from Android 2.1.0. is that a problem?
Praveen Chandrasekaran
@pixel: Can you tell something about the Login and logout options using XAuth?
Praveen Chandrasekaran
@pixel: +1 thats nice. How to do for logout option?
Praveen Chandrasekaran
AFAIK you need only just to remove AccessToken - without this you won't be able to login :)
pixel
A: 

Hi friends, thanx for this sample app,it working fine except one issue , I am getting Twitter Exception with status=403 twitting performed or not.

I seen Twitter Development site , showing status=200 means Twit Successful send.

Can anybody please tell me why this is happening.

Shubh
That Because of the tweet limitation for the minutes.
Praveen Chandrasekaran
can u pls explain it more..pls.
Shubh