我正在使用 Oauth1.0 为 android 构建 Twitter 客户端,但我被困在中间的某个地方
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
OAuthConsumer consumer = new DefaultOAuthConsumer(
"CONSUMER_KEY",
"CONSUMER_CUSTOMER_KEY");
OAuthProvider provider = new DefaultOAuthProvider(
"https://api.twitter.com/oauth/request_token",
"https://api.twitter.com/oauth/access_token",
"https://api.twitter.com/oauth/authorize");
Toast.makeText(getApplicationContext(), "fetching request token", Toast.LENGTH_SHORT).show();
try
{
String authUrl = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
// Toast.makeText(getApplicationContext(), authUrl, Toast.LENGTH_SHORT).show();
String url = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND);
this.startActivity(intent);
}
catch (OAuthMessageSignerException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (OAuthNotAuthorizedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (OAuthExpectationFailedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (OAuthCommunicationException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
现在我已经能够授权了,但是只要我输入我的用户名和密码,就会出现一个 pin 码并且不会发生重定向!那么我想要的是在不输入密码的情况下显示用户的推文!我应该怎么办 ?
提前致谢