@Path("/login")
public Response facebookLogin(@QueryParam("access_token") String access_token) {
String appId = env.get("facebook.appId");
String appSecret = env.get("facebook.appSecret");
try {
FacebookClient facebookClient = new DefaultFacebookClient(access_token);
User user = facebookClient.fetchObject("me", User.class);
String me = "";
try {
me = gson.toJson(user);
} catch (Exception e) {
e.printStackTrace();
}
Guest guest = guestService.getGuest(user.getUsername());
final String autoLoginToken = generateSecureRandomString();
if (guest==null) {
FacebookClient.AccessToken accessToken =
new DefaultFacebookClient().obtainExtendedAccessToken(appId, appSecret, access_token);
String firstname = user.getFirstName();
String lastname = user.getLastName();
guest = guestService.createGuest(user.getUsername(), firstname!=null?firstname:"",
lastname!=null?lastname:"",
null, user.getEmail(),