Problem in getting write permisions for my app


#1

Hi,
In java web application, i’m trying to tweet on twitter.
But i see the app. got only read permsions. The code snippet is
TwitterConnectionFactory connectionFactory = new TwitterConnectionFactory(CONSUMER_KEY, CONSUMER_SECRET);
OAuth1Operations oauthOperations = connectionFactory.getOAuthOperations();

long timeInMillis = System.currentTimeMillis() ;

OAuthToken requestToken = oauthOperations.fetchRequestToken(REDIRECT_URI + “?requestId=”+timeInMillis, null);
String authorizeUrl = oauthOperations.buildAuthorizeUrl(requestToken.getValue(), OAuth1Parameters.NONE);
//upon receiving the callback from the provider:
TwitterConnectionFactory connectionFactory = new TwitterConnectionFactory(CONSUMER_KEY, CONSUMER_SECRET);
OAuth1Operations oauthOperations = connectionFactory.getOAuthOperations();
OAuthToken accessToken = oauthOperations.exchangeForAccessToken(new AuthorizedRequestToken(requestToken, oauthVerifier), null);
Connection connection = connectionFactory.createConnection(accessToken);

What else i need to code here to get write permsions …


#2

go to the app settings and change the Application Type to Read and Write or Read Write and Access Direct Messages as per your requirement .I hope this should work.


#3

and also after changing the Read Write settings create the Access token again and use the new ones in the code.