cometta
cometta

Reputation: 35689

spring security integrate with facebook connect

may i know is there any tutorials/guideliness on spring security integrate with facebook connect

Upvotes: 5

Views: 8456

Answers (5)

ChrLipp
ChrLipp

Reputation: 15668

Additionally to Spring security you need Spring social, see Signing in with Service Provider Accounts. A promising blog entry is Integrating your Java Spring MVC webapp with Facebook – Part 1: Doing the OAuth Dance.

Upvotes: 1

MatBanik
MatBanik

Reputation: 26860

You can use facbook graph api to request the users info and than parse it like this:

        JSONObject resp = new JSONObject(content);
        String facebookid = resp.getString("id");
        String firstName = resp.getString("first_name");
        String lastName = resp.getString("last_name");
        String email = resp.getString("email");
        String phone = resp.getString("mobile_phone");

        JSONObject address = resp.getJSONObject("address");
        String street = address.getString("street");
        String city = address.getString("city");
        String zip = address.getString("zip");
        String state = address.getString("state");
        String country = address.getString("country");

After you have the strings calling your registration method should be easy. Than you just have to auto authenticate them.

I have posted more details about this here: Facebook Connect example in JSP (tomcat)

Upvotes: 0

Jiri Vlasimsky
Jiri Vlasimsky

Reputation: 714

Spring Social is great but works only with Spring Framework 3.0+. So watch your spring version because i tried two days to figure out how to make Spring Social work with Spring Framework 2.5 ;)

Upvotes: 2

Hans Westerbeek
Hans Westerbeek

Reputation: 5805

The guys at Springsource have launched 'Spring Social' which is worth keeping an eye on when dealing any social API (including facebook). See http://www.springsource.org/spring-social

Upvotes: 7

Raghuram
Raghuram

Reputation: 52645

Maybe you should look at OAuth for Spring Security and Authentication - Facebook Developers

Upvotes: 1

Related Questions