
AccountManager am = AccountManager.get(this);Account[] accts = am.getAccountsByType(TWITTER_ACCOUNT_TYPE);if(accts.length > 0) { Account acct = accts[0]; am.getAuthToken(acct,"com.twitter.androID.oauth.token"/*what goes here*/,null,this,new AccountManagerCallback<Bundle>() { @OverrIDe public voID run(AccountManagerFuture<Bundle> arg0) { try { Bundle b = arg0.getResult(); Log.e("TrendDroID","THIS AUTHTOKEN: " + b.getString(AccountManager.KEY_AUTHTOKEN)); } catch (Exception e) { Log.e("TrendDroID","EXCEPTION@AUTHTOKEN"); } }},null);} 现在我得到了com.twitter.androID.oauth.token和com.twitter.androID.oauth.token.secret.但下一步是什么?我如何使用它来授权?
我使用scribe API,我试着像这样使用它:
service.signRequest(new Token(token,secret),request);
但它不起作用.我还尝试了另一种不起作用的方法.
有很多这样的问题:
https://dev.twitter.com/discussions/4875
https://groups.google.com/forum/?fromgroups#!topic/twitter-development-talk/1tWEx–5h9w%5B1-25%5D
http://osdir.com/ml/twitter4j/2011-06/msg00128.html
Android: How to Twitter oAuth Through Account Manager
Twitter Authentication through Android’s AccountManager classes
Using account manager to get OAuth token
没有人给出具体的答案
解决方法 AndroID的AccountManager返回的com.twitter.androID.oauth.token和com.twitter.androID.oauth.token.secret凭据仅使用Twitter的官方消费者密钥和密钥进行身份验证. AFAIK他们对第三方开发人员实际上并没有用.关于Twitter,我只是说他们在那里,如果Twitter通过应用程序更新改变它们,他们将为没有该应用程序更新的每个用户打破OAuth.
总结以上是内存溢出为你收集整理的如何在twitter中使用android AccountManager进行授权?全部内容,希望文章能够帮你解决如何在twitter中使用android AccountManager进行授权?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)