我正在尝试以下示例应用程序的twitter oauth。android twitter retrieveRequestToken 401请求令牌
http://www.androidsdkforum.com/android-sdk-development/3-oauth-twitter.html
private void askOAuth() {
try {
consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
provider = new DefaultOAuthProvider("http://twitter.com/oauth/request_token",
"http://twitter.com/oauth/access_token",
"http://twitter.com/oauth/authorize");
String authUrl = provider.retrieveRequestToken(consumer, CALLBACK_URL);
Toast.makeText(this, "Please authorize this app!", Toast.LENGTH_LONG).show();
this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl)));
} catch (Exception e) {
Log.e(APP, e.getMessage());
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
当我运行下面的代码它提供了异常如下
“oauth.signpost.exception.OAuthNotAuthorizedException:授权失败(服务器回答道401)这可能是因为。消费者密钥不正确或签名不匹配。“
在这条线String authUrl = provider.retrieveRequestToken(consumer, CALLBACK_URL);
我提供了正确的“钥匙”和“秘密”不推特给了我错了密钥和密码
?
plz告诉我要在CALLBACK_URL中放置什么? – Shruti 2012-09-11 09:58:25
你的android活动URL会在twitter返回响应后被调用 – 2012-09-11 18:46:00
你的android活动URL会在twitter返回响应后被调用 – 2012-09-11 18:46:47