Skip to content

Instantly share code, notes, and snippets.

@cjbell
Created February 9, 2012 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjbell/1779690 to your computer and use it in GitHub Desktop.
Save cjbell/1779690 to your computer and use it in GitHub Desktop.
Facebook Login
<div id="fb-root"></div>
<script src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" charset="utf-8">
FB.init({
appId : 'APP ID HERE',
status : true,
cookie : true,
xfbml : true,
});
</script>
<script>
// Call this function once the user clicks a button
// Don't auto call it!!
FB.getLoginStatus(function(response) {
if (response.session) {
// Already logged in
} else {
FB.login(function(response) {
if (response.authResponse) {
// Logged in
} else {
// Failed
}
},{ scope:'' });
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment