How to connect Facebook, Twitter & Google accounts in Java (Spring MVC)

8.7k Views Asked by At

I'm going through the features of social auth (http://code.google.com/p/socialauth/) & wondering if this is the best thing for my requirement. Please guide.

My web application currently has it's own login mechanism(native). But I'm planning to do the following:

  1. Login through Facebook(F), Twitter(T) and Google(G) options
  2. After login (either through F,T,G or native login), I want to give user the option of selecting F friends, T followers or G contacts (in a textbox with autosuggest facility)

So my doubt is: (social auth says that "..currently Facebook, Twitter and LinkedIn do not provide email addresses. UPDATE: Hotmail has stopped providing email addresses.") So although I'll have a list of followers, friends or contacts will I be able to notify them once my user selects and submits his form?

Will it be through F,T or G respectively(through status updates, tweets or email?)

Moreover, I've one more scenario: E.g. the user has logged in using Facebook. Now I want the user to be able to link her Twitter and Google account too. Can socialauth provide that? If yes, how would I handle multiple profile objects of the same user?

Please guide or suggest any other library. My application is in Spring MVC.

Or shall I use Spring Social?

4

There are 4 best solutions below

4
On BEST ANSWER

Since your application uses Spring-MVC you should try Spring Social. It would be best for your application.

1
On

Spring Social is best option for your requirement and in can be easily integrated with

0
On

You can also use socialauth library. It also has spring version to connect with FB, twitter and others provider. Link for the same is as given below:-

http://code.google.com/p/socialauth/

0
On

There are 2 proven ways which can be used for this

  1. Using Spring-security-oauth2
  2. Using Spring Social

However, if you are using just Spring Social based on the facebook example, provided on the Spring Website then be mindful of these issues

  1. It doesn't work for more than 1 user
  2. Spring-social doesn't support Google either.
  3. It is also difficult to change the redirect flow unless you override the methods

But the good thing is there are workarounds to fix them and they are quite simple.

The Complete tutorial with step by step instructions can be found here

Having explored both oauth2 and Spring Social. I would suggest Spring-social as its lot more simpler and custom built for social logins only.