I am using the Play Framework and play.libs.OAuth, trying to connect to Twitter using the following code:
public static void twitterConnect()
{
Response response;
ServiceInfo twitterServiceInfo = new ServiceInfo(
"https://api.twitter.com/oauth/request_token",
"https://api.twitter.com/oauth/access_token",
"https://api.twitter.com/oauth/authorize",
"ZA*****************Dw",
"Zy*************************************U4");
if(OAuth.isVerifierResponse()) {
} else {
OAuth twitter = OAuth.service(twitterServiceInfo);
response = twitter.retrieveRequestToken(); <-- NOT WORKING!!!
redirect(twitter.redirectUrl(response.token));
}
}
but in the line marked <- DOES NOT WORK !!!; I get the following error:
OAuth.Error: NOT_AUTHORIZED - authorization completed (server responded with 401). This can happen if the consumer key is incorrect or the signatures do not match.
I double-checked my consumer keys and secrets, as well as requests, access and authorization of URLs, but to no avail.
Any ideas as to what is wrong with my code?
source
share