XAuth认证的微博分享Android中?XAuth、Android

由网友(「⒏甘χíη」)分享简介:我的工作对微博认证。基本身份验证将到期 8月16日起实施。因此,我们必须用的OAuth 来使用Twitter认证。但它的一些复杂实现。 的XAuth 是切断两个步骤。但问题是我到authenticate.And也有不好的文档了。我想用从的XAuth 1.6本身。其中包你建议使用。如果有任何例如或教程的specifiac...

我的工作对微博认证。基本身份验证将到期 8月16日起实施。因此,我们必须用的OAuth 来使用Twitter认证。但它的一些复杂实现。 的XAuth 是切断两个步骤。但问题是我到authenticate.And也有不好的文档了。我想用从的XAuth 1.6本身。其中包你建议使用。如果有任何例如教程的specifiacally为Android使用的XAuth 认证。

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.

推荐答案

编辑: 在我的code我这样做:

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();

然后你必须保存令牌和令牌秘密从 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);
阅读全文

相关推荐

最新文章