Skip to content

Instantly share code, notes, and snippets.

@vseventer
Created August 30, 2012 19:05
Show Gist options
  • Select an option

  • Save vseventer/3537809 to your computer and use it in GitHub Desktop.

Select an option

Save vseventer/3537809 to your computer and use it in GitHub Desktop.
Facebook authentication with Kinvey.
// Initialize the Facebook SDK.
FB.init({
appId: '<your-app-id>',
oauth: true
/* additional properties */
});
// Open login popup.
FB.login(function(response) {
if(response.authResponse) {
// Login user at Kinvey.
new Kinvey.User().loginWithFacebook(response.authResponse.accessToken, {
success: function(user) {
// User is now both a Facebook and Kinvey user.
console.log(user.getIdentity());// Logs Facebook identity.
},
error: function() {
// An error occurred.
}
});
}
else {
// User cancelled login or did not fully authorize.
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment