【发布时间】:2011-10-11 03:03:56
【问题描述】:
您好,我在使用 JTwitter 功能对我的 Twitter 应用程序进行身份验证时遇到困难。我总是收到“TwitterException”
这是我的方法
OAuthSignpostClient oauthClient = new OAuthSignpostClient(consumerKey,
privateKey, "oob");
a) 我不知道“oob”值应该是什么,它是“callbackURL”,在我的推特应用程序中它显示"callBack URL: none",所以我尝试输入"none"、"None" 和null 其中"oob" 没有不同的结果。
剩下的就是样板文件
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(oauthClient.authorizeUrl().toString()));
startActivity(i);
// get the pin
String v = oauthClient.askUser("Please enter the verification PIN from Twitter");
oauthClient.setAuthorizationCode(v);
// Store the authorisation token details for future use
String[] accessToken = oauthClient.getAccessToken();
// Next time we can use new OAuthSignpostClient(OAUTH_KEY, OAUTH_SECRET,
// accessToken[0], accessToken[1]) to avoid authenticating again.
EditText twitterText = (EditText)findViewById(R.id.twitterText);
twitterText.getText();
// Make a Twitter object
Twitter twitter = new Twitter(null, oauthClient);
// Print Daniel Winterstein's status
//System.out.println(twitter.getStatus("winterstein"));
// Set my status
twitter.setStatus(twitterText.getText());
在这一点上,我只是不确定如何进行这项工作。希望我可以更详细地说,但这与身份验证有关。我在网上看到的东西没有帮助
【问题讨论】:
标签: android authentication twitter oauth-2.0 jtwitter