What I did (and don't like it) in such situation
FacebookTemplate (and FacebookApi):
PHP Code:
public List<Map<String, String>> getAccounts()
{
ResponseEntity<Map> response = restTemplate.getForEntity(CONNECTION_URL, Map.class, CURRENT_USER_ID, "accounts");
Map<String, List<Map<String, String>>> resultsMap = response.getBody();
List<Map<String, String>> accounts = resultsMap.get("data");
return accounts;
}
Then in Controller:
PHP Code:
List<Map<String, String>> accounts = facebook.getAccounts();
String accessToken = null;
for(Map<String, String> a : accounts)
{
if (a.get("name").equals("MyPage"))
accessToken = a.get("access_token");
}
FacebookTemplate facebookTemplate = new FacebookTemplate(accessToken);
LinkedMultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
map.add("message", text);
facebookTemplate.publish("me", "feed", map);
But it's more like a hack, not solution.
Any ideas where to put those "accounts" into spring-social infrastructure?