public class Tumblr {
public static void main(String args[]) throws OAuthCommunicationException, OAuthMessageSignerException, OAuthExpectationFailedException, OAuthNotAuthorizedException
{
OAuthConsumer consumer = new DefaultOAuthConsumer("ConsumerKey",
"ConsumerSecret");
OAuthProvider provider = new DefaultOAuthProvider(
"http://www.tumblr.com/oauth/request_token", "http://www.tumblr.com/oauth/access_token",
"http://www.tumblr.com/oauth/authorize");
String CallbackURL="http://localhost:8084/FinalTumblr/index.jsp";
String authUrl = provider.retrieveRequestToken(consumer,CallbackURL);
// String authUrl[] = provider.retrieveRequestToken(OAuth.OUT_OF_BAND);
System.out.println("AuthUrl.."+authUrl);
System.out.println("Request token: " + consumer.getToken());
System.out.println("Token secret: " + consumer.getTokenSecret());
// create an HTTP request to a protected resource
}
}
EXCEPTION:
"Exception in thread "main" oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Service provider responded in error: 400 (Bad Request)
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:218)
at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:74)
at Tumblr.main(Tumblr.java:42)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Service provider responded in error: 400 (Bad Request)
at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:245)
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:193)
... 2 more
Java Result: 1"
知道这个错误发生的原因吗?