Created
January 31, 2012 17:35
-
-
Save KellyRice/1711760 to your computer and use it in GitHub Desktop.
Mark code 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// User ID | |
var _id; | |
// Facebook ready | |
window.fbAsyncInit = function() { | |
FB.init({ appId: 'XXX' }); | |
// Do we have a user? | |
FB.getLoginStatus(function(response) { | |
if('connected' === response.status) { | |
// Save user ID | |
_id = response.authResponse.userID; | |
} | |
}); | |
}; | |
// Page ready, get user from Kinvey | |
window.onload = function() { | |
// NOTE at this point, it is unsure whether FB.getLoginStatus has terminated | |
kinvey.user.fetch(_id, function(user) { | |
// User found, go ahead and render page | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment