Facebook uses oauth2 which is simple to implement, the basic flow would be something like:
- User clicks a link "login with facebook"
- You redirect to facebook oath2 endpoint
- Facebook will redirect the user back to a url you specify
- You extract the code parameter from the request
- You make an http request to facebook platform to exchange the code for an access token
- You then make another http request to facebook's graph api to retrieve the user's username, email, profile photo etc
- You can the programatically authenticate the user
Notes
Facebook has some documentation explaining how to do server-side login using oath2. It's written in PHP but you should be able to make sense of it
You can programatically authenticate a user using spring security using something like:
Code:
Authentication authentication = new UsernamePasswordAuthenticationToken(user, null, AuthorityUtils.createAuthorityList("ROLE_USER"));
SecurityContextHolder.getContext().setAuthentication(authentication);
You can make http calls from GAE using UrlFetch