Skip to content

Instantly share code, notes, and snippets.

@barkerja
Created February 15, 2012 03:48
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save barkerja/1833032 to your computer and use it in GitHub Desktop.
Save barkerja/1833032 to your computer and use it in GitHub Desktop.
Find My Friends
var options, req, request;
request = require('request');
options = {
uri: 'https://p04-fmfmobile.icloud.com/fmipservice/friends/{account_id}/{unique_device_id}/minCallback/selFriend/refreshClient',
method: 'POST',
headers: {
'X-Apple-AuthScheme': 'Forever',
'Content-type': 'application/json'
},
auth: '{account_id}:{token}',
body: JSON.stringify({"clientContext":{"appName":"FindMyFriends","appPushModeAllowed":true,"appVersion":"1.0","apsToken":"{token}","currentTime":1329270015284,"deviceClass":"iPhone","deviceHasPasscode":true,"deviceUDID":"{unique_device_id}","isAppRestricted":false,"lastLoggedInPrsId":"{account_id}","osVersion":"5.0.1","productType":"iPhone4,1","pushMode":true,"selectedFriend":"{friend_id}","userInactivityTimeInMS":30910},"dataContext":{"0":1328314711351,"1":1328314723801,"10":1328937737002,"11":0,"12":0,"13":0,"2":1328314723801,"3":1329270006376,"4":0,"5":1328901258718,"6":4,"8":19,"9":"9C5D4229E6387FD279C9EA7F3B7DD9D5","followingFenceVersion":0},"serverContext":{"authToken":"{based_64_encoded_token}","callbackTimeoutIntervalInMS":0,"clientId":"{client_id}","maxCallbackIntervalInMS":60000,"minCallbackIntervalInMS":5000,"prsId":{account_id}}})
};
req = request(options, function(error, response, body) {
var data = JSON.parse(body);
var following = [];
var locations = [];
for (var i = 0; i < data.following.length; i++) {
following[data.following[i].id] = data.following[i].invitationAcceptedByEmail;
}
for (var i = 0; i < data.locations.length; i++) {
location = data.locations[i];
if (following[location.id]) {
if (location.location != null)
locations[following[location.id]] = location.location.address.formattedAddressLines.join(', ');
}
}
for (var k in locations) {
console.log(k + ' :: ' + locations[k]);
}
});
@barkerja
Copy link
Author

The accound_id and unique_device_id properties need to be captured using a proxy.

@batteryshark
Copy link

but where does the token come from? The normal mmetokens don't seem to work...

@ndattani
Copy link

This doesn't find the GitHub profiles of all my Facebook friends?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment