I am building a Twitter client for android using Oauth1.0 and i am stuck somewhere in the middle
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();
}
}
Now i have been able to authorize with this , but as soon as i enter my username and password , A pin code appears and no redirection takes place ! Well what i want is to display tweets of the user without entering the Pin Code ! What should i do ?
Thanks in Advance
First step is to read the documentation on OOB auth on dev.twitter.com
You need to direct the user to your application to enter the supplied PIN code to complete the auth process. If you want redirection, use the full oAuth1.0a flow with either a server component, or make the callback URL a link to open your android application.