Created
February 25, 2012 13:52
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is exactly what I needed. Thank you!