Skip to content

Instantly share code, notes, and snippets.

@twinge
Created October 15, 2013 20:40
Show Gist options
  • Save twinge/6998317 to your computer and use it in GitHub Desktop.
Save twinge/6998317 to your computer and use it in GitHub Desktop.
Grabing a public fb uid
var facebook_user_id;
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'YOUR_APP_ID', // App ID from the App Dashboard
status : false, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
// Additional initialization code such as adding Event Listeners goes here
FB.getLoginStatus(function(response){
facebook_user_id = FB.getUserID()
});
};
// Load the SDK's source Asynchronously
// Note that the debug version is being actively developed and might
// contain some type checks that are overly strict.
// Please report such bugs using the bugs tool.
(function(d, debug){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, false));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment