Skip to content

Instantly share code, notes, and snippets.

@migr1
Last active May 16, 2016 17:03
Show Gist options
  • Save migr1/78b064bb831db06f4edc7b07de5c9265 to your computer and use it in GitHub Desktop.
Save migr1/78b064bb831db06f4edc7b07de5c9265 to your computer and use it in GitHub Desktop.
Matlistan FB login code
window.fbAsyncInit = function () {
FB.init({
appId: 160944750672537,
status: true,
cookie: true,
xfbml: true,
version: 'v2.3'
});
};
function fbLogin() {
FB.login(function (response) {
fbLoginDone(response);
});
}
function fbLoginDone(response) {
if (response.status === 'connected') {
$.post('/Account/LogOnFacebook', {
AccessToken: response.authResponse.accessToken
}, function (data) {
if (data.Success === true) {
window.location = 'http://www.matlistan.se/MyList';
} else {
console.log("Failed to login with Facebook account");
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment