Assuming a facebook is already establish from the frontend. (Javascript or some other means)

How can we use use spring social to detect it and add it to the UsersConnectionRepository

Example:
userId = Long.toString(userIdSequence.incrementAndGet());
ConnectionRepository repository = connectionRepository.createConnectionRepository(us erId);

connectionRepository.createConnectionRepository(us erId).addConnection(connection);

userCookieGenerator.addCookie(userId, response);
SecurityContext.setCurrentUser(new User(userId));

How do we get the facebook connection to be added.