I made an an attempt to implement OAuth for my programming idea in Java, but I failed miserably. I don\'t know why, but my code doesn\'t work. Every time I run my program, a
Try remove the parameter "oauth_callback". It worked for me. The application I was working on is a web application.
I know this is an old question but it seems it takes a bit of digging around to finally get a proper answer. This seems to be one of the top links in google too. Pages at dev.twitter.com lead to almost nowhere also. So here it goes.
Look here for a code that properly handles it. It uses HttpCore, but it can be achieved with standard libraries.
Making the story short.
As far as for this code. For request token it doesn't seem to be important at all.
connection.setRequestProperty("Accept-Charset", charset);
connection.setRequestProperty("Content-Type", "application/x-www-formurlencoded;charset="+ charset);
connection.setRequestProperty("User-Agent", "XXXX");
This one though, does
connection.setRequestMethod(method);