问题描述
我的工作对微博认证
。基本身份验证将到期 8月16日起实施。因此,我们必须用的OAuth
来使用Twitter认证。但它的一些复杂实现。 的XAuth
是切断两个步骤。但问题是我 Twitter4j
rel="nofollow">到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);
这篇关于XAuth认证的微博分享Android中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!