Wednesday, May 23, 2012

retrieveRequestToken(CommonsHttpOAuthConsumer,CALLBACK_URI) functions throws OAuthCommunicationException

I want to make an android app which will update status in twitter.
I am using signpost-core-1.2.1.1 and signpost-commonshttp4-1.2.1.1 jar files.I have given internet uses permission and i have registered app in twitter giving read,write and direct messages permission. Also filled up the callback Url.



code snippet:



private  static  final  String CALLBACK_URI = "app://twitter";
private static final String REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";
private static final String ACCESS_TOKEN_URL = "https://api.twitter.com/oauth/access_token";
private static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authorize";

String CONSUMER_KEY = "I4bwezijxf6VwpU8x0tygg";
String CONSUMER_SECRET = "Y6vSdZs3zWBrNogXZWSHKZ590RSXqB5wBwj8vFaayk";

private static CommonsHttpOAuthConsumer consumer;
private static CommonsHttpOAuthProvider provider;

consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
provider = new DefaultOAuthProvider(REQUEST_TOKEN_URL,ACCESS_TOKEN_URL, AUTHORIZE_URL);
String authUrl="";

authUrl = provider.retrieveRequestToken(consumer,CALLBACK_URI);


I am totally stuck with this.Please reply.





No comments:

Post a Comment