1

How can I implement a java backend probably on top of Spring, we will use only REST api's to access backend. user can login through standard login/password, and social authentication (facebook, google etc.). Is there a standard oauth2 implementation which we can use for this requirement. Any help will be appreciated. Thanks!

hutututu
  • 239
  • 1
  • 4
  • 11

2 Answers2

1

You could use Apache Oltu Client library to implement login through Facebook, Google, ... You have to implement your own user management for storing the API token, and to provide your login/password authentication. https://cwiki.apache.org/confluence/display/OLTU/OAuth+2.0+Client+Quickstart

Balint Domokos
  • 1,021
  • 8
  • 12
  • Does Spring-social or Apache Oltu, provide the following functionalities: 1->If I decide to login through username and password, then I should get an access token from oauth implemented at server side and then I will use this access token for all subsequent requests. 2->If I login through social auth, then the access token provided to me by facebook or google auth provider should be handled by spring social in similar way as it would have handled token generated by itself. – hutututu Mar 21 '15 at 08:21
  • There are two requirements: 1) the user can register to your server, and after providing username/password she gets an access token, which can be used for the REST API. You need to use Oltu Server for this in your server side. You can use the 'password grant type' for this, as described here: https://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified#others. For requirement 2) you need to use the Oltu client on your server side, to get an API token from Facebook or Google server, and use that token to authenticate the access to your resources. – Balint Domokos Mar 21 '15 at 19:39
1

You can also use spring social project that is built on the top of spring application framework - Spring social facebook - spring social main page

Angelo Immediata
  • 6,635
  • 4
  • 33
  • 65