I’m writing REST APIs in Scala. It has been a good experience but now I want to implement the user registration part. The industry standard being OAuth 2.0, I would like to implement an easier version of OAuth(1 or 2). Now, I’ve no clue what is the easiest way to implement it? Do I’ve to write the entire thing myself or are there any libraries that might make my life easier?
Share
I tried integrating socialauth in my application, and it was really simple. You can follow the guide at http://code.google.com/p/socialauth/wiki/GettingStarted#Step_3._Implementation.
It takes care of all the specifics for you and supports all the “usual providers”.
I had to make two adaptions for play 2.0 and scala:
SocialAuthUtil.getRequestParametersMap needs a servlet request to construct the paramsMap. I used the following code in my callback action instead:
req.queryString.map { p =>
p._1 -> p._2.head
}.asJava
(.asJava needs “import scala.collection.JavaConversions._”)