Last active
May 16, 2016 17:03
-
-
Save migr1/78b064bb831db06f4edc7b07de5c9265 to your computer and use it in GitHub Desktop.
Matlistan FB login code
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
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