xAuth Authentication for Twitter Share in Android?
Asked Answered
H

1

1

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.

Hungary answered 19/7, 2010 at 10:44 Comment(0)
S
3

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);
Solve answered 20/7, 2010 at 21:48 Comment(4)
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?Hungary
Can you tell something about the Login and logout options using XAuth?Hungary
AFAIK you need only just to remove AccessToken - without this you won't be able to login :)Solve
Usually xAuth needs to be especially enabled for an application to use it.Hermosa

© 2022 - 2024 — McMap. All rights reserved.