I am using 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 at the line marked <-- NOT WORKING!!!; I am getting the following error:
OAuth.Error: NOT_AUTHORIZED - Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.
I've double checked my consumer keys and secrets, as well as the request, access and authorize URLs, but to no avail.
Any ideas as to what is wrong with my code?
I ripped out the OAuth code, and reimplemented using the Scribe library written by Fernandez Pablo. Seems I'm getting further now. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With