Skip to content

Instantly share code, notes, and snippets.

@stphung
Created February 25, 2012 13:52
Show Gist options
  • Save stphung/1908571 to your computer and use it in GitHub Desktop.
Save stphung/1908571 to your computer and use it in GitHub Desktop.
A function that demonstrates how to do 2-legged OAuth requests with Play 2.0
def doRequest(key: String, secret: String) {
val ck = ConsumerKey(key, secret)
val oauth = OAuth(ServiceInfo(null, null, null, ck))
val calc = OAuthCalculator(ck, RequestToken("", ""))
calc.setSendEmptyTokens(true)
WS.url(endpoint).sign(calc).get.map(response => {
println(response.json)
})
}
@johangozali
Copy link

This is exactly what I needed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment