public List getContacts(Session session, int user, int contextId, int accountId) { List contacts = new ArrayList(); OAuthService service = new ServiceBuilder().provider(FacebookApi.class).apiKey(facebookMetaData.getAPIKey()).apiSecret(facebookMetaData.getAPISecret()).build(); OAuthAccount account = null; account = oAuthService.getAccount(accountId, session, user, contextId); // get the users own profile (for his id) with the given access token Token accessToken = new Token(account.getToken(), account.getSecret()); OAuthRequest ownProfileRequest = new OAuthRequest(Verb.GET, "https://graph.facebook.com/me"); service.signRequest(accessToken, ownProfileRequest); Response ownProfileResponse = ownProfileRequest.send(); String myuid = ""; JSONObject object = new JSONObject(ownProfileResponse.getBody()); myuid = object.getString("id"); // get the users connections OAuthRequest connectionsRequest = new OauthRequest( Verb.GET, "https://api.facebook.com/method/fql.query?query=SELECT%20name,first_name,last_name,email,birthday_date,pic_big,hometown_location%20from%20user%20where%20uid%20in%20%28SELECT%20uid2%20from%20friend%20where%20uid1=" + myuid + "%29&format=JSON"); service.signRequest(accessToken, connectionsRequest); Response connectionsResponse = connectionsRequest.send(); // parse the returned JSON into neat little contacts contacts = parseIntoContacts(connectionsResponse.getBody()); return contacts; }