Skip to content

Instantly share code, notes, and snippets.

@ADCDS
Created July 10, 2017 15:13
Show Gist options
  • Save ADCDS/49bcfc49a1ba70873da31a4f92debed8 to your computer and use it in GitHub Desktop.
Save ADCDS/49bcfc49a1ba70873da31a4f92debed8 to your computer and use it in GitHub Desktop.
Simple client
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<button id="login">Login</button>
<div id="fb-root"></div>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
/**
* Created by Turox on 7/10/2017.
*/
console.log('ooiooo');
function statusChangedCallback(response) {
console.log(response)
}
window.fbAsyncInit = function () {
FB.init({
appId: 113508735925978,
autoLogAppEvents: true,
xfbml: true,
version: 'v2.9'
});
FB.AppEvents.logPageView();
document.getElementById('login').onclick = function () {
console.log('Login clicked');
FB.login(function (response) {
statusChangedCallback(response);
}, {scope: 'public_profile,email'});
};
FB.getLoginStatus(function (response) {
statusChangedCallback(response);
});
};
(function (d, s, id) {
let js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment