I'm writing a play application (in scala) and I'm trying to perform the reverse-auth step that is outlined by twitter here: https://dev.twitter.com/docs/ios/using-reverse-auth
The step sounds like an ordinary RetrieveRequestToken to https://api.twitter.com/oauth/request_token with the additional parameter of setting the x_auth_mode=reverse_auth
THe play framework makes use of Sign-Post (https://code.google.com/p/oauth-signpost/) and I was wondering how I can leverage the WS library and Sign-Post to make this happen.
Here is what I came up with:
val KEY = ConsumerKey(Play.configuration.getString("twitter.consumer.key").getOrElse("XXXX"), Play.configuration.getString("twitter.consumer.secret").getOrElse("XXXX"))
def reverse = Action.async {
val oauth_calc = OAuthCalculator(KEY, RequestToken("","") )
oauth_calc.setSigningStrategy(new oauth.signpost.signature.AuthorizationHeaderSigningStrategy )
var reverse_request : Future[Response] = WS.url("https://api.twitter.com/oauth/request_token").sign(oauth_calc)
.post(Map("x_auth_mode" -> Seq("reverse_auth")))
reverse_request.map{
response => {
Logger.debug(response.body)
Ok("Here")
}
}
}
I'm getting however "Failed to validate oauth signature and token"