Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs + OAuth + Play 2.0

I'm learning Angularjs to create a single page application for a new project. The back-end will be in Scala with Play 2.0 framework in a REST style API. I would like to use FB, Twitter, Google, OpenId accounts has a way for the users to register and log in, but I don't know a lot about OAuth and how to make it work with Angular and Play 2.0 (of course I have started to read on OAuth).

Do you have any ideas of how to achieve that? Are there any libraties/tools to handle it? Or tutorial and examples?

EDIT: As pointed by Pere Villega, SecureSocial seems a good options on the Play side, but it is follow a MVC pattern (view generated on the server) as opposed to angularjs + play which is more MVP (or MVVM) + REST api on the server. For Angular I found Sapling. I have to figure out how to integrate the 2.

like image 486
Go4It Avatar asked Sep 07 '12 13:09

Go4It


2 Answers

Use Secure Social. Best invention since sliced bread. True story ;)

like image 150
Pere Villega Avatar answered Oct 14 '22 19:10

Pere Villega


Have a look at http://www.espeo.pl/2012/02/26/authentication-in-angularjs-application

It shows you how to deal with accessing secured resources from an Angular perspective, all triggered from the client side. I think you could use Secure Social on the server with all of your REST API's behind SecureAction actions in the Play! controller.

I need to do something similar, but for now I'll use LDAP since it's a corporate application I'm building. Maybe I'll look at contributing LDAP/AD to Secure Social.

like image 22
andyczerwonka Avatar answered Oct 14 '22 19:10

andyczerwonka